diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2006-03-20 12:30:04 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-03-20 12:30:04 -0500 |
commit | c752666c17f870fa8ae9f16804dd457e9e6daaec (patch) | |
tree | c3c48383f386a24edbdf3c6292f25b587e6d9368 /fs/gfs2/super.c | |
parent | 419c93e0b6b9eef0bf26b8ad415f2a5bf4300119 (diff) |
[GFS2] Fix bug in directory code and tidy up
Due to a typo, the dir leaf split operation was (for the first
split in a directory) writing the new hash vaules at the
wrong offset. This is now fixed.
Also some other tidy ups are included:
- We use GFS2's hash function for dentries (see ops_dentry.c) so that
we don't have to keep recalculating the hash values.
- A lot of common code is eliminated between the various directory
lookup routines.
- Better error checking on directory lookup (previously different
routines checked for different errors)
- The leaf split operation has a couple of redundant operations
removed from it, so it should be faster.
There is still further scope for further clean ups in the directory
code, and readdir in particular could do with slimming down a bit.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/super.c')
-rw-r--r-- | fs/gfs2/super.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index fff5a96f4152..71cca7629403 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c | |||
@@ -299,8 +299,9 @@ int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh) | |||
299 | break; | 299 | break; |
300 | 300 | ||
301 | name.len = sprintf(buf, "journal%u", sdp->sd_journals); | 301 | name.len = sprintf(buf, "journal%u", sdp->sd_journals); |
302 | name.hash = gfs2_disk_hash(name.name, name.len); | ||
302 | 303 | ||
303 | error = gfs2_dir_search(sdp->sd_jindex->u.generic_ip, | 304 | error = gfs2_dir_search(sdp->sd_jindex, |
304 | &name, NULL, NULL); | 305 | &name, NULL, NULL); |
305 | if (error == -ENOENT) { | 306 | if (error == -ENOENT) { |
306 | error = 0; | 307 | error = 0; |
@@ -317,8 +318,12 @@ int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh) | |||
317 | if (!jd) | 318 | if (!jd) |
318 | break; | 319 | break; |
319 | 320 | ||
320 | error = gfs2_lookupi(sdp->sd_jindex, &name, 1, &jd->jd_inode); | 321 | jd->jd_inode = gfs2_lookupi(sdp->sd_jindex, &name, 1, NULL); |
321 | if (error) { | 322 | if (!jd->jd_inode || IS_ERR(jd->jd_inode)) { |
323 | if (!jd->jd_inode) | ||
324 | error = -ENOENT; | ||
325 | else | ||
326 | error = PTR_ERR(jd->jd_inode); | ||
322 | kfree(jd); | 327 | kfree(jd); |
323 | break; | 328 | break; |
324 | } | 329 | } |