Re: [PATCH] fs: Improve comment of inode_dio_begin

From: Matthew Wilcox
Date: Mon Feb 19 2018 - 11:00:44 EST


On Mon, Feb 19, 2018 at 05:20:29PM +0200, Nikolay Borisov wrote:
> +++ b/include/linux/fs.h
> @@ -3015,8 +3015,10 @@ void inode_dio_wait(struct inode *inode);
> * inode_dio_begin - signal start of a direct I/O requests
> * @inode: inode the direct I/O happens on
> *
> - * This is called once we've finished processing a direct I/O request,
> - * and is used to wake up callers waiting for direct I/O to be quiesced.
> + * This is called before we begin processing a direct I/O request,
> + * and is used to quiesce callers of inode_dio_wait. It must be
> + * called under a lock that serialising getting a reference to
> + * ->i_dio_count (usually the inode_lock)
> */
> static inline void inode_dio_begin(struct inode *inode)
> {

Thanks for the patch! It'd be nice if it used the kernel-doc annotations
for Context: to document the locking requirements. Also, I find the
wording a little confusing. How does the following look?

* Mark the inode as having direct I/O in progress. This causes callers
* of inode_dio_wait() to block until the I/O has completed.
*
* Context: Process context. Caller should hold a lock that callers of
* inode_dio_wait() also hold (usually inode_lock, but this depends on
* the filesystem).