aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/ops_export.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-03-20 12:30:04 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2006-03-20 12:30:04 -0500
commitc752666c17f870fa8ae9f16804dd457e9e6daaec (patch)
treec3c48383f386a24edbdf3c6292f25b587e6d9368 /fs/gfs2/ops_export.c
parent419c93e0b6b9eef0bf26b8ad415f2a5bf4300119 (diff)
downloadkernel_samsung_aries-c752666c17f870fa8ae9f16804dd457e9e6daaec.zip
kernel_samsung_aries-c752666c17f870fa8ae9f16804dd457e9e6daaec.tar.gz
kernel_samsung_aries-c752666c17f870fa8ae9f16804dd457e9e6daaec.tar.bz2
[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/ops_export.c')
-rw-r--r--fs/gfs2/ops_export.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/gfs2/ops_export.c b/fs/gfs2/ops_export.c
index a346943..b27bce7 100644
--- a/fs/gfs2/ops_export.c
+++ b/fs/gfs2/ops_export.c
@@ -24,6 +24,7 @@
#include "inode.h"
#include "ops_export.h"
#include "rgrp.h"
+#include "util.h"
static struct dentry *gfs2_decode_fh(struct super_block *sb,
__u32 *fh,
@@ -167,11 +168,15 @@ static struct dentry *gfs2_get_parent(struct dentry *child)
struct qstr dotdot = { .name = "..", .len = 2 };
struct inode *inode;
struct dentry *dentry;
- int error;
- error = gfs2_lookupi(child->d_inode, &dotdot, 1, &inode);
- if (error)
- return ERR_PTR(error);
+ dotdot.hash = gfs2_disk_hash(dotdot.name, dotdot.len);
+
+ inode = gfs2_lookupi(child->d_inode, &dotdot, 1, NULL);
+
+ if (!inode)
+ return ERR_PTR(-ENOENT);
+ if (IS_ERR(inode))
+ return ERR_PTR(PTR_ERR(inode));
dentry = d_alloc_anon(inode);
if (!dentry) {