* [PATCH] fs: Improve comment of inode_dio_begin
@ 2018-02-19 15:20 Nikolay Borisov
2018-02-19 16:00 ` Matthew Wilcox
0 siblings, 1 reply; 2+ messages in thread
From: Nikolay Borisov @ 2018-02-19 15:20 UTC (permalink / raw)
To: viro; +Cc: linux-fsdevel, linux-kernel, axboe, Nikolay Borisov
Firstly, the description of the function was a direct copy/paste of
inode_dio_end and as such made no sense. So rewrite it to correctly
state this is used before starting an io. Also document the locking
requirements, since currently one has to look at the definition of
inode_dio_wait to see the requirement of a lock being held while
bumping i_dio_count.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
include/linux/fs.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 511fbaabf624..90ac851930ae 100644
--- a/include/linux/fs.h
+++ 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)
{
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] fs: Improve comment of inode_dio_begin
2018-02-19 15:20 [PATCH] fs: Improve comment of inode_dio_begin Nikolay Borisov
@ 2018-02-19 16:00 ` Matthew Wilcox
0 siblings, 0 replies; 2+ messages in thread
From: Matthew Wilcox @ 2018-02-19 16:00 UTC (permalink / raw)
To: Nikolay Borisov; +Cc: viro, linux-fsdevel, linux-kernel, axboe
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).
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-19 16:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-19 15:20 [PATCH] fs: Improve comment of inode_dio_begin Nikolay Borisov
2018-02-19 16:00 ` Matthew Wilcox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).