aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/file.c')
-rw-r--r--fs/gfs2/file.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index 89c39e53760d..f82cb5e1cb6b 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -544,7 +544,9 @@ static int gfs2_close(struct inode *inode, struct file *file)
544 544
545/** 545/**
546 * gfs2_fsync - sync the dirty data for a file (across the cluster) 546 * gfs2_fsync - sync the dirty data for a file (across the cluster)
547 * @file: the file that points to the dentry (we ignore this) 547 * @file: the file that points to the dentry
548 * @start: the start position in the file to sync
549 * @end: the end position in the file to sync
548 * @datasync: set if we can ignore timestamp changes 550 * @datasync: set if we can ignore timestamp changes
549 * 551 *
550 * The VFS will flush data for us. We only need to worry 552 * The VFS will flush data for us. We only need to worry
@@ -553,23 +555,32 @@ static int gfs2_close(struct inode *inode, struct file *file)
553 * Returns: errno 555 * Returns: errno
554 */ 556 */
555 557
556static int gfs2_fsync(struct file *file, int datasync) 558static int gfs2_fsync(struct file *file, loff_t start, loff_t end,
559 int datasync)
557{ 560{
558 struct inode *inode = file->f_mapping->host; 561 struct inode *inode = file->f_mapping->host;
559 int sync_state = inode->i_state & (I_DIRTY_SYNC|I_DIRTY_DATASYNC); 562 int sync_state = inode->i_state & (I_DIRTY_SYNC|I_DIRTY_DATASYNC);
560 struct gfs2_inode *ip = GFS2_I(inode); 563 struct gfs2_inode *ip = GFS2_I(inode);
561 int ret; 564 int ret;
562 565
566 ret = filemap_write_and_wait_range(inode->i_mapping, start, end);
567 if (ret)
568 return ret;
569 mutex_lock(&inode->i_mutex);
570
563 if (datasync) 571 if (datasync)
564 sync_state &= ~I_DIRTY_SYNC; 572 sync_state &= ~I_DIRTY_SYNC;
565 573
566 if (sync_state) { 574 if (sync_state) {
567 ret = sync_inode_metadata(inode, 1); 575 ret = sync_inode_metadata(inode, 1);
568 if (ret) 576 if (ret) {
577 mutex_unlock(&inode->i_mutex);
569 return ret; 578 return ret;
579 }
570 gfs2_ail_flush(ip->i_gl); 580 gfs2_ail_flush(ip->i_gl);
571 } 581 }
572 582
583 mutex_unlock(&inode->i_mutex);
573 return 0; 584 return 0;
574} 585}
575 586