aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2011-03-30 11:13:25 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2011-04-20 03:55:07 -0400
commit1027efaa238e1b65c07b6c2d9e270e548c2bdb07 (patch)
treedc02c7a8ebeb2b7c52a09b0150019f6236ca3de9 /fs/gfs2
parent556bb17998a37dabf7e9e96aa545bcea899be745 (diff)
GFS2: Make ->write_inode() really write
The GFS2 ->write_inode function should be more aggressive at writing back to the filesystem. This adopts the XFS system of returning -EAGAIN when the writeback has not been completely done. Also, we now kick off in-place writeback when called with WB_SYNC_NONE, but we only wait for it and flush the log when WB_SYNC_ALL is requested. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/super.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index b9f28e66dad1..d827b934cbd3 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -704,7 +704,7 @@ void gfs2_unfreeze_fs(struct gfs2_sbd *sdp)
704/** 704/**
705 * gfs2_write_inode - Make sure the inode is stable on the disk 705 * gfs2_write_inode - Make sure the inode is stable on the disk
706 * @inode: The inode 706 * @inode: The inode
707 * @sync: synchronous write flag 707 * @wbc: The writeback control structure
708 * 708 *
709 * Returns: errno 709 * Returns: errno
710 */ 710 */
@@ -713,15 +713,16 @@ static int gfs2_write_inode(struct inode *inode, struct writeback_control *wbc)
713{ 713{
714 struct gfs2_inode *ip = GFS2_I(inode); 714 struct gfs2_inode *ip = GFS2_I(inode);
715 struct gfs2_sbd *sdp = GFS2_SB(inode); 715 struct gfs2_sbd *sdp = GFS2_SB(inode);
716 struct address_space *metamapping = gfs2_glock2aspace(ip->i_gl);
716 struct gfs2_holder gh; 717 struct gfs2_holder gh;
717 struct buffer_head *bh; 718 struct buffer_head *bh;
718 struct timespec atime; 719 struct timespec atime;
719 struct gfs2_dinode *di; 720 struct gfs2_dinode *di;
720 int ret = 0; 721 int ret = -EAGAIN;
721 722
722 /* Check this is a "normal" inode, etc */ 723 /* Skip timestamp update, if this is from a memalloc */
723 if (current->flags & PF_MEMALLOC) 724 if (current->flags & PF_MEMALLOC)
724 return 0; 725 goto do_flush;
725 ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); 726 ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh);
726 if (ret) 727 if (ret)
727 goto do_flush; 728 goto do_flush;
@@ -745,6 +746,11 @@ do_unlock:
745do_flush: 746do_flush:
746 if (wbc->sync_mode == WB_SYNC_ALL) 747 if (wbc->sync_mode == WB_SYNC_ALL)
747 gfs2_log_flush(GFS2_SB(inode), ip->i_gl); 748 gfs2_log_flush(GFS2_SB(inode), ip->i_gl);
749 filemap_fdatawrite(metamapping);
750 if (!ret && (wbc->sync_mode == WB_SYNC_ALL))
751 ret = filemap_fdatawait(metamapping);
752 if (ret)
753 mark_inode_dirty_sync(inode);
748 return ret; 754 return ret;
749} 755}
750 756
@@ -874,8 +880,9 @@ restart:
874 880
875static int gfs2_sync_fs(struct super_block *sb, int wait) 881static int gfs2_sync_fs(struct super_block *sb, int wait)
876{ 882{
877 if (wait && sb->s_fs_info) 883 struct gfs2_sbd *sdp = sb->s_fs_info;
878 gfs2_log_flush(sb->s_fs_info, NULL); 884 if (wait && sdp)
885 gfs2_log_flush(sdp, NULL);
879 return 0; 886 return 0;
880} 887}
881 888