aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/dir.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-04-11 14:49:06 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-04-11 14:49:06 -0400
commitf4154ea039bbf45c52840b30c68143a2dc28d4b4 (patch)
treefa00645dd60a9140e885be96a4aa9797cf4cfeac /fs/gfs2/dir.c
parented3865079b573ef55dc13ab0bfb242ed5ebab4c1 (diff)
[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,
776 goto got_dent; 776 goto got_dent;
777 leaf = (struct gfs2_leaf *)bh->b_data; 777 leaf = (struct gfs2_leaf *)bh->b_data;
778 ln = be64_to_cpu(leaf->lf_next); 778 ln = be64_to_cpu(leaf->lf_next);
779 brelse(bh);
779 if (!ln) 780 if (!ln)
780 break; 781 break;
781 brelse(bh);
782 error = get_leaf(ip, ln, &bh); 782 error = get_leaf(ip, ln, &bh);
783 } while(!error); 783 } while(!error);
784 784
@@ -790,7 +790,7 @@ static struct gfs2_dirent *gfs2_dirent_search(struct inode *inode,
790 return ERR_PTR(error); 790 return ERR_PTR(error);
791 dent = gfs2_dirent_scan(inode, bh->b_data, bh->b_size, scan, name, NULL); 791 dent = gfs2_dirent_scan(inode, bh->b_data, bh->b_size, scan, name, NULL);
792got_dent: 792got_dent:
793 if (unlikely(IS_ERR(dent))) { 793 if (unlikely(dent == NULL || IS_ERR(dent))) {
794 brelse(bh); 794 brelse(bh);
795 bh = NULL; 795 bh = NULL;
796 } 796 }
@@ -1477,7 +1477,6 @@ int gfs2_dir_search(struct inode *dir, const struct qstr *name,
1477 brelse(bh); 1477 brelse(bh);
1478 return 0; 1478 return 0;
1479 } 1479 }
1480 brelse(bh);
1481 return -ENOENT; 1480 return -ENOENT;
1482} 1481}
1483 1482
@@ -1619,7 +1618,6 @@ int gfs2_dir_del(struct gfs2_inode *dip, const struct qstr *name)
1619 previous entry otherwise */ 1618 previous entry otherwise */
1620 dent = gfs2_dirent_search(dip->i_vnode, name, gfs2_dirent_prev, &bh); 1619 dent = gfs2_dirent_search(dip->i_vnode, name, gfs2_dirent_prev, &bh);
1621 if (!dent) { 1620 if (!dent) {
1622 brelse(bh);
1623 gfs2_consist_inode(dip); 1621 gfs2_consist_inode(dip);
1624 return -EIO; 1622 return -EIO;
1625 } 1623 }
@@ -1680,7 +1678,6 @@ int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename,
1680 1678
1681 dent = gfs2_dirent_search(dip->i_vnode, filename, gfs2_dirent_find, &bh); 1679 dent = gfs2_dirent_search(dip->i_vnode, filename, gfs2_dirent_find, &bh);
1682 if (!dent) { 1680 if (!dent) {
1683 brelse(bh);
1684 gfs2_consist_inode(dip); 1681 gfs2_consist_inode(dip);
1685 return -EIO; 1682 return -EIO;
1686 } 1683 }
@@ -1961,7 +1958,6 @@ int gfs2_diradd_alloc_required(struct inode *inode,
1961 1958
1962 dent = gfs2_dirent_search(inode, name, gfs2_dirent_find_space, &bh); 1959 dent = gfs2_dirent_search(inode, name, gfs2_dirent_find_space, &bh);
1963 if (!dent) { 1960 if (!dent) {
1964 brelse(bh);
1965 return 1; 1961 return 1;
1966 } 1962 }
1967 if (IS_ERR(dent)) 1963 if (IS_ERR(dent))