summaryrefslogtreecommitdiffstats
path: root/fs/gfs2/dir.c
diff options
context:
space:
mode:
authorSteven Whitehouse2006-04-11 20:49:06 +0200
committerSteven Whitehouse2006-04-11 20:49:06 +0200
commitf4154ea039bbf45c52840b30c68143a2dc28d4b4 (patch)
treefa00645dd60a9140e885be96a4aa9797cf4cfeac /fs/gfs2/dir.c
parent[GFS2] Finally get ref counting correct (diff)
downloadkernel-qcow2-linux-f4154ea039bbf45c52840b30c68143a2dc28d4b4.tar.gz
kernel-qcow2-linux-f4154ea039bbf45c52840b30c68143a2dc28d4b4.tar.xz
kernel-qcow2-linux-f4154ea039bbf45c52840b30c68143a2dc28d4b4.zip
[GFS2] Update journal accounting code.
A small update to the journaling code to change the way that the "extra" blocks are accounted for in the journal. These are used at a rate of one per 503 metadata blocks or one per 251 journaled data blocks (or just one if the total number of journaled blocks in the transaction is smaller). Since we are using them at two different rates the old method of accounting for them no longer works and we count them up as required. Since the "per transaction" accounting can't handle this (there is no fixed number of header blocks per transaction) we have to account for it in the general journal code. We now require that each transaction reserves more blocks than it actually needs to take account of the possible extra blocks. Also a final fix to dir.c to ensure that all ref counts are handled correctly. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/dir.c')
-rw-r--r--fs/gfs2/dir.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index 100672d2c6c5..01f89c727cc8 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -776,9 +776,9 @@ static struct gfs2_dirent *gfs2_dirent_search(struct inode *inode,
goto got_dent;
leaf = (struct gfs2_leaf *)bh->b_data;
ln = be64_to_cpu(leaf->lf_next);
+ brelse(bh);
if (!ln)
break;
- brelse(bh);
error = get_leaf(ip, ln, &bh);
} while(!error);
@@ -790,7 +790,7 @@ static struct gfs2_dirent *gfs2_dirent_search(struct inode *inode,
return ERR_PTR(error);
dent = gfs2_dirent_scan(inode, bh->b_data, bh->b_size, scan, name, NULL);
got_dent:
- if (unlikely(IS_ERR(dent))) {
+ if (unlikely(dent == NULL || IS_ERR(dent))) {
brelse(bh);
bh = NULL;
}
@@ -1477,7 +1477,6 @@ int gfs2_dir_search(struct inode *dir, const struct qstr *name,
brelse(bh);
return 0;
}
- brelse(bh);
return -ENOENT;
}
@@ -1619,7 +1618,6 @@ int gfs2_dir_del(struct gfs2_inode *dip, const struct qstr *name)
previous entry otherwise */
dent = gfs2_dirent_search(dip->i_vnode, name, gfs2_dirent_prev, &bh);
if (!dent) {
- brelse(bh);
gfs2_consist_inode(dip);
return -EIO;
}
@@ -1680,7 +1678,6 @@ int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename,
dent = gfs2_dirent_search(dip->i_vnode, filename, gfs2_dirent_find, &bh);
if (!dent) {
- brelse(bh);
gfs2_consist_inode(dip);
return -EIO;
}
@@ -1961,7 +1958,6 @@ int gfs2_diradd_alloc_required(struct inode *inode,
dent = gfs2_dirent_search(inode, name, gfs2_dirent_find_space, &bh);
if (!dent) {
- brelse(bh);
return 1;
}
if (IS_ERR(dent))