aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/super.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2011-08-02 08:13:20 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2011-10-21 07:39:21 -0400
commit1d4ec642d9f00d4c531b1a4ae0613091ec1f8e9b (patch)
tree71b7c5944b21d87750802e70dcd69698f17b3e7d /fs/gfs2/super.c
parent75549186edf1515062fe2fcbfbd92bd99659afba (diff)
GFS2: Make atime checks more efficient
We do not need to start a transaction unless the atime check has proved positive. Also if we are going to flush the complete ail list anyway, we might as well skip the writeback for this specific inode's metadata, since that will be done as part of the ail writeback process in an order offering potentially more efficient I/O. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/super.c')
-rw-r--r--fs/gfs2/super.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index b7beadd9ba4c..afb87615c014 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -768,30 +768,30 @@ static int gfs2_write_inode(struct inode *inode, struct writeback_control *wbc)
768 goto do_flush; 768 goto do_flush;
769 unlock_required = 1; 769 unlock_required = 1;
770 } 770 }
771 ret = gfs2_trans_begin(sdp, RES_DINODE, 0);
772 if (ret)
773 goto do_unlock;
774 ret = gfs2_meta_inode_buffer(ip, &bh); 771 ret = gfs2_meta_inode_buffer(ip, &bh);
775 if (ret == 0) { 772 if (ret == 0) {
776 di = (struct gfs2_dinode *)bh->b_data; 773 di = (struct gfs2_dinode *)bh->b_data;
777 atime.tv_sec = be64_to_cpu(di->di_atime); 774 atime.tv_sec = be64_to_cpu(di->di_atime);
778 atime.tv_nsec = be32_to_cpu(di->di_atime_nsec); 775 atime.tv_nsec = be32_to_cpu(di->di_atime_nsec);
779 if (timespec_compare(&inode->i_atime, &atime) > 0) { 776 if (timespec_compare(&inode->i_atime, &atime) > 0) {
780 gfs2_trans_add_bh(ip->i_gl, bh, 1); 777 ret = gfs2_trans_begin(sdp, RES_DINODE, 0);
781 gfs2_dinode_out(ip, bh->b_data); 778 if (ret == 0) {
779 gfs2_trans_add_bh(ip->i_gl, bh, 1);
780 gfs2_dinode_out(ip, bh->b_data);
781 gfs2_trans_end(sdp);
782 }
782 } 783 }
783 brelse(bh); 784 brelse(bh);
784 } 785 }
785 gfs2_trans_end(sdp);
786do_unlock:
787 if (unlock_required) 786 if (unlock_required)
788 gfs2_glock_dq_uninit(&gh); 787 gfs2_glock_dq_uninit(&gh);
789do_flush: 788do_flush:
790 if (wbc->sync_mode == WB_SYNC_ALL) 789 if (wbc->sync_mode == WB_SYNC_ALL)
791 gfs2_log_flush(GFS2_SB(inode), ip->i_gl); 790 gfs2_log_flush(GFS2_SB(inode), ip->i_gl);
792 filemap_fdatawrite(metamapping);
793 if (bdi->dirty_exceeded) 791 if (bdi->dirty_exceeded)
794 gfs2_ail1_flush(sdp, wbc); 792 gfs2_ail1_flush(sdp, wbc);
793 else
794 filemap_fdatawrite(metamapping);
795 if (!ret && (wbc->sync_mode == WB_SYNC_ALL)) 795 if (!ret && (wbc->sync_mode == WB_SYNC_ALL))
796 ret = filemap_fdatawait(metamapping); 796 ret = filemap_fdatawait(metamapping);
797 if (ret) 797 if (ret)