diff options
author | Josef Bacik <josef@redhat.com> | 2011-07-16 20:44:56 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-07-20 20:47:59 -0400 |
commit | 02c24a82187d5a628c68edfe71ae60dc135cd178 (patch) | |
tree | c8dbaba4d82e2b20ed4335910a564a1f7d90fcf6 /Documentation | |
parent | 22735068d53c7115e384bc88dea95b17e76a6839 (diff) |
fs: push i_mutex and filemap_write_and_wait down into ->fsync() handlers
Btrfs needs to be able to control how filemap_write_and_wait_range() is called
in fsync to make it less of a painful operation, so push down taking i_mutex and
the calling of filemap_write_and_wait() down into the ->fsync() handlers. Some
file systems can drop taking the i_mutex altogether it seems, like ext3 and
ocfs2. For correctness sake I just pushed everything down in all cases to make
sure that we keep the current behavior the same for everybody, and then each
individual fs maintainer can make up their mind about what to do from there.
Thanks,
Acked-by: Jan Kara <jack@suse.cz>
Signed-off-by: Josef Bacik <josef@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/filesystems/Locking | 6 | ||||
-rw-r--r-- | Documentation/filesystems/porting | 7 | ||||
-rw-r--r-- | Documentation/filesystems/vfs.txt | 2 |
3 files changed, 10 insertions, 5 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking index 9b6ed7c9f34f..ca7e25292542 100644 --- a/Documentation/filesystems/Locking +++ b/Documentation/filesystems/Locking | |||
@@ -412,7 +412,7 @@ prototypes: | |||
412 | int (*open) (struct inode *, struct file *); | 412 | int (*open) (struct inode *, struct file *); |
413 | int (*flush) (struct file *); | 413 | int (*flush) (struct file *); |
414 | int (*release) (struct inode *, struct file *); | 414 | int (*release) (struct inode *, struct file *); |
415 | int (*fsync) (struct file *, int datasync); | 415 | int (*fsync) (struct file *, loff_t start, loff_t end, int datasync); |
416 | int (*aio_fsync) (struct kiocb *, int datasync); | 416 | int (*aio_fsync) (struct kiocb *, int datasync); |
417 | int (*fasync) (int, struct file *, int); | 417 | int (*fasync) (int, struct file *, int); |
418 | int (*lock) (struct file *, int, struct file_lock *); | 418 | int (*lock) (struct file *, int, struct file_lock *); |
@@ -438,9 +438,7 @@ prototypes: | |||
438 | 438 | ||
439 | locking rules: | 439 | locking rules: |
440 | All may block except for ->setlease. | 440 | All may block except for ->setlease. |
441 | No VFS locks held on entry except for ->fsync and ->setlease. | 441 | No VFS locks held on entry except for ->setlease. |
442 | |||
443 | ->fsync() has i_mutex on inode. | ||
444 | 442 | ||
445 | ->setlease has the file_list_lock held and must not sleep. | 443 | ->setlease has the file_list_lock held and must not sleep. |
446 | 444 | ||
diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting index 6b96773e27cb..7f8861d341ea 100644 --- a/Documentation/filesystems/porting +++ b/Documentation/filesystems/porting | |||
@@ -421,3 +421,10 @@ data and there is a virtual hole at the end of the file. So if the provided | |||
421 | offset is less than i_size and SEEK_DATA is specified, return the same offset. | 421 | offset is less than i_size and SEEK_DATA is specified, return the same offset. |
422 | If the above is true for the offset and you are given SEEK_HOLE, return the end | 422 | If the above is true for the offset and you are given SEEK_HOLE, return the end |
423 | of the file. If the offset is i_size or greater return -ENXIO in either case. | 423 | of the file. If the offset is i_size or greater return -ENXIO in either case. |
424 | |||
425 | [mandatory] | ||
426 | If you have your own ->fsync() you must make sure to call | ||
427 | filemap_write_and_wait_range() so that all dirty pages are synced out properly. | ||
428 | You must also keep in mind that ->fsync() is not called with i_mutex held | ||
429 | anymore, so if you require i_mutex locking you must make sure to take it and | ||
430 | release it yourself. | ||
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt index 6bf85b78cfea..eff6617c9a0f 100644 --- a/Documentation/filesystems/vfs.txt +++ b/Documentation/filesystems/vfs.txt | |||
@@ -777,7 +777,7 @@ struct file_operations { | |||
777 | int (*open) (struct inode *, struct file *); | 777 | int (*open) (struct inode *, struct file *); |
778 | int (*flush) (struct file *); | 778 | int (*flush) (struct file *); |
779 | int (*release) (struct inode *, struct file *); | 779 | int (*release) (struct inode *, struct file *); |
780 | int (*fsync) (struct file *, int datasync); | 780 | int (*fsync) (struct file *, loff_t, loff_t, int datasync); |
781 | int (*aio_fsync) (struct kiocb *, int datasync); | 781 | int (*aio_fsync) (struct kiocb *, int datasync); |
782 | int (*fasync) (int, struct file *, int); | 782 | int (*fasync) (int, struct file *, int); |
783 | int (*lock) (struct file *, int, struct file_lock *); | 783 | int (*lock) (struct file *, int, struct file_lock *); |