0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 15:33:54 +01:00

ircd::fs: Improve strategy for AIO fsync/fdsync related.

This commit is contained in:
Jason Volk 2018-12-01 16:06:33 -08:00
parent ca525b081f
commit 711dfacd9a
4 changed files with 28 additions and 23 deletions

View file

@ -25,8 +25,11 @@ namespace ircd::fs::aio
struct kernel;
struct request;
extern kernel *context;
extern struct stats stats;
extern kernel *context;
extern const bool available_fsync;
extern const bool available_fdsync;
}
/// Statistics structure.

View file

@ -28,7 +28,7 @@ struct ircd::fs::fsync_opts
/// direct syscall is made. Using AIO will only block one ircd::ctx while
/// a direct syscall will block the thread (all contexts). If AIO is not
/// available or enabled setting this has no effect.
bool use_aio {true};
bool async {true};
/// Request priority. This value is ignored by the kernel for the
/// operations provided by this interface. It is still provided for

View file

@ -4458,9 +4458,7 @@ noexcept try
};
#endif
//TODO: AIO fdsync() throwing -EINVAL.
fs::fsync_opts opts;
opts.use_aio = false;
fs::fdsync(fd, opts);
return Status::OK();
}
@ -4507,9 +4505,7 @@ noexcept try
};
#endif
//TODO: AIO fdsync() throwing -EINVAL.
fs::fsync_opts opts;
opts.use_aio = false;
fs::fdsync(fd, opts);
return Status::OK();
}
@ -4554,9 +4550,7 @@ noexcept try
};
#endif
//TODO: AIO fdsync() throwing -EINVAL.
fs::fsync_opts opts;
opts.use_aio = false;
fs::fsync(fd, opts);
return Status::OK();
}
@ -6630,9 +6624,7 @@ noexcept try
};
#endif
//TODO: AIO fdsync() throwing -EINVAL.
fs::fsync_opts opts;
opts.use_aio = false;
fs::fsync(fd, opts);
return Status::OK();
}
@ -6679,9 +6671,7 @@ noexcept try
};
#endif
//TODO: AIO fdsync() throwing -EINVAL.
fs::fsync_opts opts;
opts.use_aio = false;
fs::fdsync(fd, opts);
return Status::OK();
}
@ -6728,9 +6718,7 @@ noexcept try
};
#endif
//TODO: AIO fdsync() throwing -EINVAL.
fs::fsync_opts opts;
opts.use_aio = false;
fs::fdsync(fd, opts);
return Status::OK();
}

View file

@ -406,7 +406,7 @@ ircd::fs::fsync(const fd &fd,
try
{
#ifdef IRCD_USE_AIO
if(likely(aio::context) && opts.use_aio)
if(aio::context && opts.async && aio::available_fsync)
return aio::fsync(fd, opts);
#endif
@ -434,7 +434,7 @@ ircd::fs::fdsync(const fd &fd,
try
{
#ifdef IRCD_USE_AIO
if(likely(aio::context) && opts.use_aio)
if(aio::context && opts.async && aio::available_fdsync)
return aio::fdsync(fd, opts);
#endif
@ -893,15 +893,29 @@ catch(const std::exception &e)
// fs/aio.h
//
/// Non-null when aio is available for use
decltype(ircd::fs::aio::context)
ircd::fs::aio::context
{};
/// Global stats structure
decltype(ircd::fs::aio::stats)
ircd::fs::aio::stats
{};
ircd::fs::aio::stats;
/// Non-null when aio is available for use
decltype(ircd::fs::aio::context)
ircd::fs::aio::context;
/// True if IOCB_CMD_FSYNC is supported by AIO. If this is false then
/// fs::fsync_opts::async=true flag is ignored.
decltype(ircd::fs::aio::available_fsync)
ircd::fs::aio::available_fsync
{
false //TODO: Detect kernel support
};
/// True if IOCB_CMD_FDSYNC is supported by AIO. If this is false then
/// fs::fsync_opts::async=true flag is ignored.
decltype(ircd::fs::aio::available_fdsync)
ircd::fs::aio::available_fdsync
{
false //TODO: Detect kernel support
};
//
// init