From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel@redhat.com, linux-kernel@vger.kernel.org
Cc: Steven Whitehouse <swhiteho@redhat.com>
Subject: [PATCH 15/24] GFS2: Use cached rgrp in gfs2_rlist_add()
Date: Mon, 24 Oct 2011 13:48:29 +0100 [thread overview]
Message-ID: <1319460518-9046-16-git-send-email-swhiteho@redhat.com> (raw)
In-Reply-To: <1319460518-9046-1-git-send-email-swhiteho@redhat.com>
Each block which is deallocated, requires a call to gfs2_rlist_add()
and each of those calls was calling gfs2_blk2rgrpd() in order to
figure out which rgrp the block belonged in. This can be speeded up
by making use of the rgrp cached in the inode. We also reset this
cached rgrp in case the block has changed rgrp. This should provide
a big reduction in gfs2_blk2rgrpd() calls during deallocation.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 9d3a0c2..22ad413 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -724,7 +724,7 @@ static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh,
blen++;
else {
if (bstart)
- gfs2_rlist_add(sdp, &rlist, bstart);
+ gfs2_rlist_add(ip, &rlist, bstart);
bstart = bn;
blen = 1;
@@ -732,7 +732,7 @@ static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh,
}
if (bstart)
- gfs2_rlist_add(sdp, &rlist, bstart);
+ gfs2_rlist_add(ip, &rlist, bstart);
else
goto out; /* Nothing to do */
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index 90b877b..8ccad24 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -1821,7 +1821,7 @@ static int leaf_dealloc(struct gfs2_inode *dip, u32 index, u32 len,
if (blk != leaf_no)
brelse(bh);
- gfs2_rlist_add(sdp, &rlist, blk);
+ gfs2_rlist_add(dip, &rlist, blk);
l_blocks++;
}
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 08b3a80..3088fb2 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -1560,7 +1560,7 @@ fail:
/**
* gfs2_rlist_add - add a RG to a list of RGs
- * @sdp: the filesystem
+ * @ip: the inode
* @rlist: the list of resource groups
* @block: the block
*
@@ -1570,9 +1570,10 @@ fail:
*
*/
-void gfs2_rlist_add(struct gfs2_sbd *sdp, struct gfs2_rgrp_list *rlist,
+void gfs2_rlist_add(struct gfs2_inode *ip, struct gfs2_rgrp_list *rlist,
u64 block)
{
+ struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
struct gfs2_rgrpd *rgd;
struct gfs2_rgrpd **tmp;
unsigned int new_space;
@@ -1581,12 +1582,15 @@ void gfs2_rlist_add(struct gfs2_sbd *sdp, struct gfs2_rgrp_list *rlist,
if (gfs2_assert_warn(sdp, !rlist->rl_ghs))
return;
- rgd = gfs2_blk2rgrpd(sdp, block);
+ if (ip->i_rgd && rgrp_contains_block(ip->i_rgd, block))
+ rgd = ip->i_rgd;
+ else
+ rgd = gfs2_blk2rgrpd(sdp, block);
if (!rgd) {
- if (gfs2_consist(sdp))
- fs_err(sdp, "block = %llu\n", (unsigned long long)block);
+ fs_err(sdp, "rlist_add: no rgrp for block %llu\n", (unsigned long long)block);
return;
}
+ ip->i_rgd = rgd;
for (x = 0; x < rlist->rl_rgrps; x++)
if (rlist->rl_rgd[x] == rgd)
diff --git a/fs/gfs2/rgrp.h b/fs/gfs2/rgrp.h
index 0439fca..0e886d8 100644
--- a/fs/gfs2/rgrp.h
+++ b/fs/gfs2/rgrp.h
@@ -60,7 +60,7 @@ struct gfs2_rgrp_list {
struct gfs2_holder *rl_ghs;
};
-extern void gfs2_rlist_add(struct gfs2_sbd *sdp, struct gfs2_rgrp_list *rlist,
+extern void gfs2_rlist_add(struct gfs2_inode *ip, struct gfs2_rgrp_list *rlist,
u64 block);
extern void gfs2_rlist_alloc(struct gfs2_rgrp_list *rlist, unsigned int state);
extern void gfs2_rlist_free(struct gfs2_rgrp_list *rlist);
diff --git a/fs/gfs2/xattr.c b/fs/gfs2/xattr.c
index e7bf0ea..71d7bf8 100644
--- a/fs/gfs2/xattr.c
+++ b/fs/gfs2/xattr.c
@@ -1356,14 +1356,14 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip)
blen++;
else {
if (bstart)
- gfs2_rlist_add(sdp, &rlist, bstart);
+ gfs2_rlist_add(ip, &rlist, bstart);
bstart = bn;
blen = 1;
}
blks++;
}
if (bstart)
- gfs2_rlist_add(sdp, &rlist, bstart);
+ gfs2_rlist_add(ip, &rlist, bstart);
else
goto out;
--
1.7.4.4
next prev parent reply other threads:[~2011-10-24 12:50 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-24 12:48 GFS2: Pre-pull patch posting (merge window) Steven Whitehouse
2011-10-24 12:48 ` [PATCH 01/24] GFS2: Clean up dir hash table reading Steven Whitehouse
2011-10-24 12:48 ` [PATCH 02/24] GFS2: Split data write & wait in fsync Steven Whitehouse
2011-10-24 12:48 ` [PATCH 03/24] GFS2: Fix bug-trap in ail flush code Steven Whitehouse
2011-10-24 12:48 ` [PATCH 04/24] GFS2: Make atime checks more efficient Steven Whitehouse
2011-10-24 12:48 ` [PATCH 05/24] GFS2: Fix inode allocation error path Steven Whitehouse
2011-10-24 12:48 ` [PATCH 06/24] GFS2: Fix bug trap and journaled data fsync Steven Whitehouse
2011-10-24 12:48 ` [PATCH 07/24] GFS2: Use ->dirty_inode() Steven Whitehouse
2011-10-24 12:48 ` [PATCH 08/24] GFS2: Clean up gfs2_create Steven Whitehouse
2011-10-24 12:48 ` [PATCH 09/24] GFS2: Fix lseek after SEEK_DATA, SEEK_HOLE have been added Steven Whitehouse
2011-10-25 7:54 ` Andi Kleen
2011-10-24 12:48 ` [PATCH 10/24] GFS2: Use rbtree for resource groups and clean up bitmap buffer ref count scheme Steven Whitehouse
2011-10-24 12:48 ` [PATCH 11/24] GFS2: Make resource groups "append only" during life of fs Steven Whitehouse
2011-10-24 12:48 ` [PATCH 12/24] GFS2: Cache the most recently used resource group in the inode Steven Whitehouse
2011-10-24 12:48 ` [PATCH 13/24] GFS2: Remove obsolete assert Steven Whitehouse
2011-10-24 12:48 ` [PATCH 14/24] GFS2: Call do_strip() directly from recursive_scan() Steven Whitehouse
2011-10-24 12:48 ` Steven Whitehouse [this message]
2011-10-24 12:48 ` [PATCH 16/24] GFS2: Fix AIL flush issue during fsync Steven Whitehouse
2011-10-24 12:48 ` [PATCH 17/24] GFS2: Correctly set goal block after allocation Steven Whitehouse
2011-10-24 12:48 ` [PATCH 18/24] GFS2: Clean up ->page_mkwrite Steven Whitehouse
2011-10-24 12:48 ` [PATCH 19/24] GFS2: Fix off-by-one in gfs2_blk2rgrpd Steven Whitehouse
2011-10-24 12:48 ` [PATCH 20/24] GFS2: speed up delete/unlink performance for large files Steven Whitehouse
2011-10-24 12:48 ` [PATCH 21/24] GFS2: rewrite fallocate code to write blocks directly Steven Whitehouse
2011-10-24 12:48 ` [PATCH 22/24] GFS2: Misc fixes Steven Whitehouse
2011-10-24 12:48 ` [PATCH 23/24] GFS2: Remove two unused variables Steven Whitehouse
2011-10-24 12:48 ` [PATCH 24/24] GFS2: Move readahead of metadata during deallocation into its own function Steven Whitehouse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1319460518-9046-16-git-send-email-swhiteho@redhat.com \
--to=swhiteho@redhat.com \
--cc=cluster-devel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®