aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2014-01-08 06:05:29 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2014-01-08 06:05:29 -0500
commit22b5a6c0c0cd5eb524d31c949d113c6683e37ec9 (patch)
tree2beb4ff4d988e191992eed8c42cfc275ae94413e
parent62e96cf81988101fe9e086b2877307b6adda5197 (diff)
GFS2: For exhash conversion, only one block is needed
For most cases, only a single new block is needed when we reach the point of converting from stuffed to exhash directory. The exception being when the file name is so long that it will not fit within the new leaf block. So this patch adds a simple test for that situation so that we do not need to request the full reservation size in this case. Potentially we could calculate more accurately the value to use in other cases too, but that is much more complicated to do and it is doubtful that the benefit would outweigh the extra cost in code complexity. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
-rw-r--r--fs/gfs2/dir.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index d5988aafaa74..b2e5ebfb4bb1 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -2035,7 +2035,9 @@ out:
2035int gfs2_diradd_alloc_required(struct inode *inode, const struct qstr *name, 2035int gfs2_diradd_alloc_required(struct inode *inode, const struct qstr *name,
2036 struct gfs2_diradd *da) 2036 struct gfs2_diradd *da)
2037{ 2037{
2038 struct gfs2_inode *ip = GFS2_I(inode);
2038 struct gfs2_sbd *sdp = GFS2_SB(inode); 2039 struct gfs2_sbd *sdp = GFS2_SB(inode);
2040 const unsigned int extra = sizeof(struct gfs2_dinode) - sizeof(struct gfs2_leaf);
2039 struct gfs2_dirent *dent; 2041 struct gfs2_dirent *dent;
2040 struct buffer_head *bh; 2042 struct buffer_head *bh;
2041 2043
@@ -2046,6 +2048,9 @@ int gfs2_diradd_alloc_required(struct inode *inode, const struct qstr *name,
2046 dent = gfs2_dirent_search(inode, name, gfs2_dirent_find_space, &bh); 2048 dent = gfs2_dirent_search(inode, name, gfs2_dirent_find_space, &bh);
2047 if (!dent) { 2049 if (!dent) {
2048 da->nr_blocks = sdp->sd_max_dirres; 2050 da->nr_blocks = sdp->sd_max_dirres;
2051 if (!(ip->i_diskflags & GFS2_DIF_EXHASH) &&
2052 (GFS2_DIRENT_SIZE(name->len) < extra))
2053 da->nr_blocks = 1;
2049 return 0; 2054 return 0;
2050 } 2055 }
2051 if (IS_ERR(dent)) 2056 if (IS_ERR(dent))