GFS2: Make writeback more responsive to system conditions
From 8b1c8ac1cddab47e7e0cdee0c000bc2b8e345e8b Mon Sep 17 00:00:00 2001
From: Steven Whitehouse <[email protected]>
Date: Mon, 18 Apr 2011 14:18:09 +0100
Subject: GFS2: Make writeback more responsive to system conditions
This patch adds writeback_control to writing back the AIL list. This means that we can then take advantage of the information we get in ->write_inode() in order to set off some pre-emptive writeback.
In addition, the AIL code is cleaned up a bit to make it a bit simpler to understand.
There is still more which can usefully be done in this area, but this is a good start at least.
Signed-off-by Steven Whitehouse <[email protected]>
fs/gfs2/export.c +1 -1
@@ -139,7 +139,7 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb,struct gfs2_sbd *sdp = sb->s_fs_info;struct inode *inode; - inode =gfs2_ilookup (sb, inum->no_addr); + inode =gfs2_ilookup (sb, inum->no_addr,0 );if (inode) {if (GFS2_I (inode)->i_no_formal_ino != inum->no_formal_ino) {iput (inode);
fs/gfs2/glock.c +1 -1
@@ -649,7 +649,7 @@ static void delete_work_func(struct work_struct *work)/* Note: Unsafe to dereference ip as we don't hold right refs/locks */ if (ip) - inode =gfs2_ilookup (sdp->sd_vfs, no_addr); + inode =gfs2_ilookup (sdp->sd_vfs, no_addr,1 );else inode =gfs2_lookup_by_inum (sdp, no_addr,NULL ,GFS2_BLKST_UNLINKED );if (inode && !IS_ERR (inode)) {
fs/gfs2/incore.h +0 -4
@@ -20,7 +20,6 @@#define DIO_WAIT 0x00000010#define DIO_METADATA 0x00000020 -#define DIO_ALL 0x00000100struct gfs2_log_operations ;struct gfs2_log_element ;
@@ -377,8 +376,6 @@ struct gfs2_ail {unsigned int ai_first;struct list_head ai_ail1_list;struct list_head ai_ail2_list; - -u64 ai_sync_gen; };struct gfs2_journal_extent {
@@ -657,7 +654,6 @@ struct gfs2_sbd {spinlock_t sd_ail_lock;struct list_head sd_ail1_list;struct list_head sd_ail2_list; -u64 sd_ail_sync_gen;/* Replay stuff */
fs/gfs2/inode.c +2 -2
@@ -74,14 +74,14 @@ static int iget_set(struct inode *inode, void *opaque)return 0 ; } -struct inode *gfs2_ilookup (struct super_block *sb,u64 no_addr) +struct inode *gfs2_ilookup (struct super_block *sb,u64 no_addr,int non_block) {unsigned long hash = (unsigned long )no_addr;struct gfs2_skip_data data; data.no_addr = no_addr; data.skipped =0 ; - data.non_block =0 ; + data.non_block = non_block;return ilookup5 (sb, hash, iget_test, &data); }
fs/gfs2/inode.h +1 -1
@@ -102,7 +102,7 @@ extern struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned type,extern struct inode *gfs2_lookup_by_inum (struct gfs2_sbd *sdp,u64 no_addr,u64 *no_formal_ino,unsigned int blktype); -extern struct inode *gfs2_ilookup (struct super_block *sb,u64 no_addr); +extern struct inode *gfs2_ilookup (struct super_block *sb,u64 no_addr,int nonblock);extern int gfs2_inode_refresh (struct gfs2_inode *ip);
fs/gfs2/log.c +85 -80
250 lines not on this page · raw message
fs/gfs2/log.h +2 -0
@@ -12,6 +12,7 @@#include <linux/list.h> #include <linux/spinlock.h> +#include <linux/writeback.h> #include "incore.h" /**
@@ -59,6 +60,7 @@ extern struct buffer_head *gfs2_log_fake_buf(struct gfs2_sbd *sdp,extern void gfs2_log_flush (struct gfs2_sbd *sdp,struct gfs2_glock *gl);extern void gfs2_log_commit (struct gfs2_sbd *sdp,struct gfs2_trans *trans);extern void gfs2_remove_from_ail (struct gfs2_bufdata *bd); +extern void gfs2_ail1_flush (struct gfs2_sbd *sdp,struct writeback_control *wbc);extern void gfs2_log_shutdown (struct gfs2_sbd *sdp);extern void gfs2_meta_syncfs (struct gfs2_sbd *sdp);
fs/gfs2/super.c +6 -1
@@ -23,6 +23,7 @@#include <linux/time.h> #include <linux/wait.h> #include <linux/writeback.h> +#include <linux/backing-dev.h> #include "gfs2.h" #include "incore.h"
@@ -714,6 +715,7 @@ static int gfs2_write_inode(struct inode *inode, struct writeback_control *wbc)struct gfs2_inode *ip =GFS2_I (inode);struct gfs2_sbd *sdp =GFS2_SB (inode);struct address_space *metamapping =gfs2_glock2aspace (ip->i_gl); +struct backing_dev_info *bdi = metamapping->backing_dev_info;struct gfs2_holder gh;struct buffer_head *bh;struct timespec atime;
@@ -747,6 +749,8 @@ do_flush:if (wbc->sync_mode ==WB_SYNC_ALL )gfs2_log_flush (GFS2_SB (inode), ip->i_gl);filemap_fdatawrite (metamapping); +if (bdi->dirty_exceeded) +gfs2_ail1_flush (sdp, wbc);if (!ret && (wbc->sync_mode ==WB_SYNC_ALL )) ret =filemap_fdatawait (metamapping);if (ret)
@@ -1366,7 +1370,8 @@ static int gfs2_dinode_dealloc(struct gfs2_inode *ip)if (error) goto out_rindex_relse; - error =gfs2_trans_begin (sdp,RES_RG_BIT +RES_STATFS +RES_QUOTA ,1 ); + error =gfs2_trans_begin (sdp,RES_RG_BIT +RES_STATFS +RES_QUOTA , + sdp->sd_jdesc->jd_blocks);if (error) goto out_rg_gunlock;
Signature · 1 line
1.7.4