diff options
author | Chris Mason <mason@suse.com> | 2005-09-13 04:25:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-13 11:22:29 -0400 |
commit | 9f03783ce5d851e4b98dfaf3e9eb177870f6c75d (patch) | |
tree | 6f0cdc9322b723649eebd259954f72556f11439c /fs | |
parent | 9f1583339a6f52c0c26441d39a0deff8246800f7 (diff) |
[PATCH] reiserfs: use mark_inode_dirty instead of reiserfs_update_sd
reiserfs should use mark_inode_dirty during reiserfs_file_write and
reiserfs_commit_write. This makes sure the inode is properly flagged as
dirty, which is used during O_SYNC to decide when to trigger log commits.
This patch also removes the O_SYNC check from reiserfs_commit_write, since
that gets dealt with properly at higher layers once we start using
mark_inode_dirty.
Thanks to Hifumi Hisashi <hifumi.hisashi@lab.ntt.co.jp> for catching this.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/reiserfs/file.c | 11 | ||||
-rw-r--r-- | fs/reiserfs/inode.c | 16 |
2 files changed, 13 insertions, 14 deletions
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index c9f178fb494f..c20babd6216d 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c | |||
@@ -667,7 +667,7 @@ static int reiserfs_allocate_blocks_for_region(struct reiserfs_transaction_handl | |||
667 | if (th->t_trans_id) { | 667 | if (th->t_trans_id) { |
668 | int err; | 668 | int err; |
669 | // update any changes we made to blk count | 669 | // update any changes we made to blk count |
670 | reiserfs_update_sd(th, inode); | 670 | mark_inode_dirty(inode); |
671 | err = | 671 | err = |
672 | journal_end(th, inode->i_sb, | 672 | journal_end(th, inode->i_sb, |
673 | JOURNAL_PER_BALANCE_CNT * 3 + 1 + | 673 | JOURNAL_PER_BALANCE_CNT * 3 + 1 + |
@@ -855,17 +855,18 @@ static int reiserfs_submit_file_region_for_write(struct reiserfs_transaction_han | |||
855 | 855 | ||
856 | if (th->t_trans_id) { | 856 | if (th->t_trans_id) { |
857 | reiserfs_write_lock(inode->i_sb); | 857 | reiserfs_write_lock(inode->i_sb); |
858 | reiserfs_update_sd(th, inode); // And update on-disk metadata | 858 | // this sets the proper flags for O_SYNC to trigger a commit |
859 | mark_inode_dirty(inode); | ||
859 | reiserfs_write_unlock(inode->i_sb); | 860 | reiserfs_write_unlock(inode->i_sb); |
860 | } else | 861 | } else |
861 | inode->i_sb->s_op->dirty_inode(inode); | 862 | mark_inode_dirty(inode); |
862 | 863 | ||
863 | sd_update = 1; | 864 | sd_update = 1; |
864 | } | 865 | } |
865 | if (th->t_trans_id) { | 866 | if (th->t_trans_id) { |
866 | reiserfs_write_lock(inode->i_sb); | 867 | reiserfs_write_lock(inode->i_sb); |
867 | if (!sd_update) | 868 | if (!sd_update) |
868 | reiserfs_update_sd(th, inode); | 869 | mark_inode_dirty(inode); |
869 | status = journal_end(th, th->t_super, th->t_blocks_allocated); | 870 | status = journal_end(th, th->t_super, th->t_blocks_allocated); |
870 | if (status) | 871 | if (status) |
871 | retval = status; | 872 | retval = status; |
@@ -1320,7 +1321,7 @@ static ssize_t reiserfs_file_write(struct file *file, /* the file we are going t | |||
1320 | return err; | 1321 | return err; |
1321 | } | 1322 | } |
1322 | reiserfs_update_inode_transaction(inode); | 1323 | reiserfs_update_inode_transaction(inode); |
1323 | reiserfs_update_sd(&th, inode); | 1324 | mark_inode_dirty(inode); |
1324 | err = journal_end(&th, inode->i_sb, 1); | 1325 | err = journal_end(&th, inode->i_sb, 1); |
1325 | if (err) { | 1326 | if (err) { |
1326 | reiserfs_write_unlock(inode->i_sb); | 1327 | reiserfs_write_unlock(inode->i_sb); |
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 1a8a1bf2154d..d76ee6c4f9b8 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -2639,6 +2639,12 @@ static int reiserfs_commit_write(struct file *f, struct page *page, | |||
2639 | } | 2639 | } |
2640 | reiserfs_update_inode_transaction(inode); | 2640 | reiserfs_update_inode_transaction(inode); |
2641 | inode->i_size = pos; | 2641 | inode->i_size = pos; |
2642 | /* | ||
2643 | * this will just nest into our transaction. It's important | ||
2644 | * to use mark_inode_dirty so the inode gets pushed around on the | ||
2645 | * dirty lists, and so that O_SYNC works as expected | ||
2646 | */ | ||
2647 | mark_inode_dirty(inode); | ||
2642 | reiserfs_update_sd(&myth, inode); | 2648 | reiserfs_update_sd(&myth, inode); |
2643 | update_sd = 1; | 2649 | update_sd = 1; |
2644 | ret = journal_end(&myth, inode->i_sb, 1); | 2650 | ret = journal_end(&myth, inode->i_sb, 1); |
@@ -2649,21 +2655,13 @@ static int reiserfs_commit_write(struct file *f, struct page *page, | |||
2649 | if (th) { | 2655 | if (th) { |
2650 | reiserfs_write_lock(inode->i_sb); | 2656 | reiserfs_write_lock(inode->i_sb); |
2651 | if (!update_sd) | 2657 | if (!update_sd) |
2652 | reiserfs_update_sd(th, inode); | 2658 | mark_inode_dirty(inode); |
2653 | ret = reiserfs_end_persistent_transaction(th); | 2659 | ret = reiserfs_end_persistent_transaction(th); |
2654 | reiserfs_write_unlock(inode->i_sb); | 2660 | reiserfs_write_unlock(inode->i_sb); |
2655 | if (ret) | 2661 | if (ret) |
2656 | goto out; | 2662 | goto out; |
2657 | } | 2663 | } |
2658 | 2664 | ||
2659 | /* we test for O_SYNC here so we can commit the transaction | ||
2660 | ** for any packed tails the file might have had | ||
2661 | */ | ||
2662 | if (f && (f->f_flags & O_SYNC)) { | ||
2663 | reiserfs_write_lock(inode->i_sb); | ||
2664 | ret = reiserfs_commit_for_inode(inode); | ||
2665 | reiserfs_write_unlock(inode->i_sb); | ||
2666 | } | ||
2667 | out: | 2665 | out: |
2668 | return ret; | 2666 | return ret; |
2669 | 2667 | ||