diff options
author | Abhijith Das <adas@redhat.com> | 2009-05-12 12:16:20 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2009-05-12 11:14:05 -0400 |
commit | 7537d81aa7b7cd31b0caeac8091456e93d96fa8d (patch) | |
tree | a65c003b5514b7fd65a4337f33b971ff39f72ef4 /fs/gfs2/ops_address.c | |
parent | 48bf2b1711dc498494e77705c415ee46bb508fd9 (diff) |
GFS2: Fix timestamps on write
This patch copies the timestamps from the vfs inode into gfs2 and syncs
it to the disk inode during writes.
Signed-off-by: Abhijith Das <adas@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/ops_address.c')
-rw-r--r-- | fs/gfs2/ops_address.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c index a6dde1751e17..e5664210f0d8 100644 --- a/fs/gfs2/ops_address.c +++ b/fs/gfs2/ops_address.c | |||
@@ -781,10 +781,12 @@ static int gfs2_stuffed_write_end(struct inode *inode, struct buffer_head *dibh, | |||
781 | unlock_page(page); | 781 | unlock_page(page); |
782 | page_cache_release(page); | 782 | page_cache_release(page); |
783 | 783 | ||
784 | if (inode->i_size < to) { | 784 | if (copied) { |
785 | i_size_write(inode, to); | 785 | if (inode->i_size < to) { |
786 | ip->i_disksize = inode->i_size; | 786 | i_size_write(inode, to); |
787 | di->di_size = cpu_to_be64(inode->i_size); | 787 | ip->i_disksize = inode->i_size; |
788 | } | ||
789 | gfs2_dinode_out(ip, di); | ||
788 | mark_inode_dirty(inode); | 790 | mark_inode_dirty(inode); |
789 | } | 791 | } |
790 | 792 | ||
@@ -824,7 +826,6 @@ static int gfs2_write_end(struct file *file, struct address_space *mapping, | |||
824 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 826 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
825 | struct buffer_head *dibh; | 827 | struct buffer_head *dibh; |
826 | struct gfs2_alloc *al = ip->i_alloc; | 828 | struct gfs2_alloc *al = ip->i_alloc; |
827 | struct gfs2_dinode *di; | ||
828 | unsigned int from = pos & (PAGE_CACHE_SIZE - 1); | 829 | unsigned int from = pos & (PAGE_CACHE_SIZE - 1); |
829 | unsigned int to = from + len; | 830 | unsigned int to = from + len; |
830 | int ret; | 831 | int ret; |
@@ -847,11 +848,10 @@ static int gfs2_write_end(struct file *file, struct address_space *mapping, | |||
847 | gfs2_page_add_databufs(ip, page, from, to); | 848 | gfs2_page_add_databufs(ip, page, from, to); |
848 | 849 | ||
849 | ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata); | 850 | ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata); |
850 | 851 | if (ret > 0) { | |
851 | if (likely(ret >= 0) && (inode->i_size > ip->i_disksize)) { | 852 | if (inode->i_size > ip->i_disksize) |
852 | di = (struct gfs2_dinode *)dibh->b_data; | 853 | ip->i_disksize = inode->i_size; |
853 | ip->i_disksize = inode->i_size; | 854 | gfs2_dinode_out(ip, dibh->b_data); |
854 | di->di_size = cpu_to_be64(inode->i_size); | ||
855 | mark_inode_dirty(inode); | 855 | mark_inode_dirty(inode); |
856 | } | 856 | } |
857 | 857 | ||