aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/file.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2011-11-21 05:01:25 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2011-11-21 05:01:25 -0500
commit4442f2e03ed9646664c94e197e637b03324a6664 (patch)
tree93f6219e9ccdc509413a773b5e815a4bcc7e0626 /fs/gfs2/file.c
parentb9f417f311a7141d0ba67e5c8e535010d2712f2d (diff)
GFS2: O_(D)SYNC support for fallocate
Add sync of metadata after fallocate for O_SYNC files to ensure that we meet expectations for everything being on disk in this case. Unfortunately, the offset and len parameters are modified during the course of the fallocate function, so I've had to add a couple of new variables to call generic_write_sync() at the end. I know that potentially this will sync data as well within the range, but I think that is a fairly harmless side-effect overall, since we would not normally expect there to be any dirty data within the range in question. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com> Cc: Christoph Hellwig <hch@infradead.org> Cc: Benjamin Marzinski <bmarzins@redhat.com>
Diffstat (limited to 'fs/gfs2/file.c')
-rw-r--r--fs/gfs2/file.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index 6336bc6bf458..9b6c6ac351a8 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -752,6 +752,8 @@ static long gfs2_fallocate(struct file *file, int mode, loff_t offset,
752 loff_t bytes, max_bytes; 752 loff_t bytes, max_bytes;
753 struct gfs2_alloc *al; 753 struct gfs2_alloc *al;
754 int error; 754 int error;
755 const loff_t pos = offset;
756 const loff_t count = len;
755 loff_t bsize_mask = ~((loff_t)sdp->sd_sb.sb_bsize - 1); 757 loff_t bsize_mask = ~((loff_t)sdp->sd_sb.sb_bsize - 1);
756 loff_t next = (offset + len - 1) >> sdp->sd_sb.sb_bsize_shift; 758 loff_t next = (offset + len - 1) >> sdp->sd_sb.sb_bsize_shift;
757 loff_t max_chunk_size = UINT_MAX & bsize_mask; 759 loff_t max_chunk_size = UINT_MAX & bsize_mask;
@@ -834,6 +836,9 @@ retry:
834 gfs2_quota_unlock(ip); 836 gfs2_quota_unlock(ip);
835 gfs2_alloc_put(ip); 837 gfs2_alloc_put(ip);
836 } 838 }
839
840 if (error == 0)
841 error = generic_write_sync(file, pos, count);
837 goto out_unlock; 842 goto out_unlock;
838 843
839out_trans_fail: 844out_trans_fail: