diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-03-19 21:01:03 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-04-09 14:12:55 -0400 |
commit | 8d71db4f0890605d44815a2b2da4ca003f1bb142 (patch) | |
tree | e5bb078717c3e8ace7f032b940ada7901dbab545 /fs | |
parent | 5f2e354f5212a49fc639c25de2581cc8ae90d11b (diff) |
lift sb_start_write/sb_end_write out of ->aio_write()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/aio.c | 4 | ||||
-rw-r--r-- | fs/btrfs/file.c | 3 | ||||
-rw-r--r-- | fs/cifs/file.c | 3 | ||||
-rw-r--r-- | fs/compat.c | 6 | ||||
-rw-r--r-- | fs/fuse/file.c | 2 | ||||
-rw-r--r-- | fs/ntfs/file.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/file.c | 3 | ||||
-rw-r--r-- | fs/read_write.c | 8 | ||||
-rw-r--r-- | fs/xfs/xfs_file.c | 3 |
9 files changed, 14 insertions, 20 deletions
@@ -1324,6 +1324,8 @@ static ssize_t aio_rw_vect_retry(struct kiocb *iocb) | |||
1324 | if (iocb->ki_pos < 0) | 1324 | if (iocb->ki_pos < 0) |
1325 | return -EINVAL; | 1325 | return -EINVAL; |
1326 | 1326 | ||
1327 | if (opcode == IOCB_CMD_PWRITEV) | ||
1328 | file_start_write(file); | ||
1327 | do { | 1329 | do { |
1328 | ret = rw_op(iocb, &iocb->ki_iovec[iocb->ki_cur_seg], | 1330 | ret = rw_op(iocb, &iocb->ki_iovec[iocb->ki_cur_seg], |
1329 | iocb->ki_nr_segs - iocb->ki_cur_seg, | 1331 | iocb->ki_nr_segs - iocb->ki_cur_seg, |
@@ -1336,6 +1338,8 @@ static ssize_t aio_rw_vect_retry(struct kiocb *iocb) | |||
1336 | } while (ret > 0 && iocb->ki_left > 0 && | 1338 | } while (ret > 0 && iocb->ki_left > 0 && |
1337 | (opcode == IOCB_CMD_PWRITEV || | 1339 | (opcode == IOCB_CMD_PWRITEV || |
1338 | (!S_ISFIFO(inode->i_mode) && !S_ISSOCK(inode->i_mode)))); | 1340 | (!S_ISFIFO(inode->i_mode) && !S_ISSOCK(inode->i_mode)))); |
1341 | if (opcode == IOCB_CMD_PWRITEV) | ||
1342 | file_end_write(file); | ||
1339 | 1343 | ||
1340 | /* This means we must have transferred all that we could */ | 1344 | /* This means we must have transferred all that we could */ |
1341 | /* No need to retry anymore */ | 1345 | /* No need to retry anymore */ |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 5b4ea5f55b8f..254aeb72915f 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -1514,8 +1514,6 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, | |||
1514 | size_t count, ocount; | 1514 | size_t count, ocount; |
1515 | bool sync = (file->f_flags & O_DSYNC) || IS_SYNC(file->f_mapping->host); | 1515 | bool sync = (file->f_flags & O_DSYNC) || IS_SYNC(file->f_mapping->host); |
1516 | 1516 | ||
1517 | sb_start_write(inode->i_sb); | ||
1518 | |||
1519 | mutex_lock(&inode->i_mutex); | 1517 | mutex_lock(&inode->i_mutex); |
1520 | 1518 | ||
1521 | err = generic_segment_checks(iov, &nr_segs, &ocount, VERIFY_READ); | 1519 | err = generic_segment_checks(iov, &nr_segs, &ocount, VERIFY_READ); |
@@ -1617,7 +1615,6 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, | |||
1617 | if (sync) | 1615 | if (sync) |
1618 | atomic_dec(&BTRFS_I(inode)->sync_writers); | 1616 | atomic_dec(&BTRFS_I(inode)->sync_writers); |
1619 | out: | 1617 | out: |
1620 | sb_end_write(inode->i_sb); | ||
1621 | current->backing_dev_info = NULL; | 1618 | current->backing_dev_info = NULL; |
1622 | return num_written ? num_written : err; | 1619 | return num_written ? num_written : err; |
1623 | } | 1620 | } |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 7a0dd99e4507..2d4a231dd70b 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -2520,8 +2520,6 @@ cifs_writev(struct kiocb *iocb, const struct iovec *iov, | |||
2520 | 2520 | ||
2521 | BUG_ON(iocb->ki_pos != pos); | 2521 | BUG_ON(iocb->ki_pos != pos); |
2522 | 2522 | ||
2523 | sb_start_write(inode->i_sb); | ||
2524 | |||
2525 | /* | 2523 | /* |
2526 | * We need to hold the sem to be sure nobody modifies lock list | 2524 | * We need to hold the sem to be sure nobody modifies lock list |
2527 | * with a brlock that prevents writing. | 2525 | * with a brlock that prevents writing. |
@@ -2545,7 +2543,6 @@ cifs_writev(struct kiocb *iocb, const struct iovec *iov, | |||
2545 | } | 2543 | } |
2546 | 2544 | ||
2547 | up_read(&cinode->lock_sem); | 2545 | up_read(&cinode->lock_sem); |
2548 | sb_end_write(inode->i_sb); | ||
2549 | return rc; | 2546 | return rc; |
2550 | } | 2547 | } |
2551 | 2548 | ||
diff --git a/fs/compat.c b/fs/compat.c index d487985dd0ea..daa3b771d64d 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -1103,10 +1103,12 @@ static ssize_t compat_do_readv_writev(int type, struct file *file, | |||
1103 | fnv = file->f_op->aio_write; | 1103 | fnv = file->f_op->aio_write; |
1104 | } | 1104 | } |
1105 | 1105 | ||
1106 | if (fnv) | 1106 | if (fnv) { |
1107 | file_start_write(file); | ||
1107 | ret = do_sync_readv_writev(file, iov, nr_segs, tot_len, | 1108 | ret = do_sync_readv_writev(file, iov, nr_segs, tot_len, |
1108 | pos, fnv); | 1109 | pos, fnv); |
1109 | else | 1110 | file_end_write(file); |
1111 | } else | ||
1110 | ret = do_loop_readv_writev(file, iov, nr_segs, pos, fn); | 1112 | ret = do_loop_readv_writev(file, iov, nr_segs, pos, fn); |
1111 | 1113 | ||
1112 | out: | 1114 | out: |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 34b80ba95bad..d15c6f21c17f 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -971,7 +971,6 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
971 | return err; | 971 | return err; |
972 | 972 | ||
973 | count = ocount; | 973 | count = ocount; |
974 | sb_start_write(inode->i_sb); | ||
975 | mutex_lock(&inode->i_mutex); | 974 | mutex_lock(&inode->i_mutex); |
976 | 975 | ||
977 | /* We can write back this queue in page reclaim */ | 976 | /* We can write back this queue in page reclaim */ |
@@ -1030,7 +1029,6 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
1030 | out: | 1029 | out: |
1031 | current->backing_dev_info = NULL; | 1030 | current->backing_dev_info = NULL; |
1032 | mutex_unlock(&inode->i_mutex); | 1031 | mutex_unlock(&inode->i_mutex); |
1033 | sb_end_write(inode->i_sb); | ||
1034 | 1032 | ||
1035 | return written ? written : err; | 1033 | return written ? written : err; |
1036 | } | 1034 | } |
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c index 5b2d4f0853ac..1da4b81e6f76 100644 --- a/fs/ntfs/file.c +++ b/fs/ntfs/file.c | |||
@@ -2129,7 +2129,6 @@ static ssize_t ntfs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
2129 | 2129 | ||
2130 | BUG_ON(iocb->ki_pos != pos); | 2130 | BUG_ON(iocb->ki_pos != pos); |
2131 | 2131 | ||
2132 | sb_start_write(inode->i_sb); | ||
2133 | mutex_lock(&inode->i_mutex); | 2132 | mutex_lock(&inode->i_mutex); |
2134 | ret = ntfs_file_aio_write_nolock(iocb, iov, nr_segs, &iocb->ki_pos); | 2133 | ret = ntfs_file_aio_write_nolock(iocb, iov, nr_segs, &iocb->ki_pos); |
2135 | mutex_unlock(&inode->i_mutex); | 2134 | mutex_unlock(&inode->i_mutex); |
@@ -2138,7 +2137,6 @@ static ssize_t ntfs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
2138 | if (err < 0) | 2137 | if (err < 0) |
2139 | ret = err; | 2138 | ret = err; |
2140 | } | 2139 | } |
2141 | sb_end_write(inode->i_sb); | ||
2142 | return ret; | 2140 | return ret; |
2143 | } | 2141 | } |
2144 | 2142 | ||
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 6474cb44004d..1c93e771e950 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -2248,8 +2248,6 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb, | |||
2248 | if (iocb->ki_left == 0) | 2248 | if (iocb->ki_left == 0) |
2249 | return 0; | 2249 | return 0; |
2250 | 2250 | ||
2251 | sb_start_write(inode->i_sb); | ||
2252 | |||
2253 | appending = file->f_flags & O_APPEND ? 1 : 0; | 2251 | appending = file->f_flags & O_APPEND ? 1 : 0; |
2254 | direct_io = file->f_flags & O_DIRECT ? 1 : 0; | 2252 | direct_io = file->f_flags & O_DIRECT ? 1 : 0; |
2255 | 2253 | ||
@@ -2423,7 +2421,6 @@ out_sems: | |||
2423 | ocfs2_iocb_clear_sem_locked(iocb); | 2421 | ocfs2_iocb_clear_sem_locked(iocb); |
2424 | 2422 | ||
2425 | mutex_unlock(&inode->i_mutex); | 2423 | mutex_unlock(&inode->i_mutex); |
2426 | sb_end_write(inode->i_sb); | ||
2427 | 2424 | ||
2428 | if (written) | 2425 | if (written) |
2429 | ret = written; | 2426 | ret = written; |
diff --git a/fs/read_write.c b/fs/read_write.c index f7b5a23b804b..3e1791a2cfd6 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
@@ -398,6 +398,7 @@ ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, lof | |||
398 | struct kiocb kiocb; | 398 | struct kiocb kiocb; |
399 | ssize_t ret; | 399 | ssize_t ret; |
400 | 400 | ||
401 | file_start_write(filp); | ||
401 | init_sync_kiocb(&kiocb, filp); | 402 | init_sync_kiocb(&kiocb, filp); |
402 | kiocb.ki_pos = *ppos; | 403 | kiocb.ki_pos = *ppos; |
403 | kiocb.ki_left = len; | 404 | kiocb.ki_left = len; |
@@ -413,6 +414,7 @@ ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, lof | |||
413 | if (-EIOCBQUEUED == ret) | 414 | if (-EIOCBQUEUED == ret) |
414 | ret = wait_on_sync_kiocb(&kiocb); | 415 | ret = wait_on_sync_kiocb(&kiocb); |
415 | *ppos = kiocb.ki_pos; | 416 | *ppos = kiocb.ki_pos; |
417 | file_end_write(filp); | ||
416 | return ret; | 418 | return ret; |
417 | } | 419 | } |
418 | 420 | ||
@@ -758,10 +760,12 @@ static ssize_t do_readv_writev(int type, struct file *file, | |||
758 | fnv = file->f_op->aio_write; | 760 | fnv = file->f_op->aio_write; |
759 | } | 761 | } |
760 | 762 | ||
761 | if (fnv) | 763 | if (fnv) { |
764 | file_start_write(file); | ||
762 | ret = do_sync_readv_writev(file, iov, nr_segs, tot_len, | 765 | ret = do_sync_readv_writev(file, iov, nr_segs, tot_len, |
763 | pos, fnv); | 766 | pos, fnv); |
764 | else | 767 | file_end_write(file); |
768 | } else | ||
765 | ret = do_loop_readv_writev(file, iov, nr_segs, pos, fn); | 769 | ret = do_loop_readv_writev(file, iov, nr_segs, pos, fn); |
766 | 770 | ||
767 | out: | 771 | out: |
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index f03bf1a456fb..3800128d2171 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c | |||
@@ -775,8 +775,6 @@ xfs_file_aio_write( | |||
775 | if (ocount == 0) | 775 | if (ocount == 0) |
776 | return 0; | 776 | return 0; |
777 | 777 | ||
778 | sb_start_write(inode->i_sb); | ||
779 | |||
780 | if (XFS_FORCED_SHUTDOWN(ip->i_mount)) { | 778 | if (XFS_FORCED_SHUTDOWN(ip->i_mount)) { |
781 | ret = -EIO; | 779 | ret = -EIO; |
782 | goto out; | 780 | goto out; |
@@ -800,7 +798,6 @@ xfs_file_aio_write( | |||
800 | } | 798 | } |
801 | 799 | ||
802 | out: | 800 | out: |
803 | sb_end_write(inode->i_sb); | ||
804 | return ret; | 801 | return ret; |
805 | } | 802 | } |
806 | 803 | ||