Whamcloud - gitweb
land v0.9.1 on HEAD, in preparation for a 1.0.x branch
[fs/lustre-release.git] / lustre / kernel_patches / patches / ext3-raw-lookup-pdirops.patch
1  fs/ext3/namei.c    |   31 +++++++++++++++++++++++++++++++
2  include/linux/fs.h |    1 +
3  2 files changed, 32 insertions(+)
4
5 --- linux-2.4.18-p4smp1Guser/include/linux/fs.h~ext3-raw-lookup Thu Sep 25 15:59:59 2003
6 +++ linux-2.4.18-p4smp1Guser-pschwan/include/linux/fs.h Thu Sep 25 15:59:59 2003
7 @@ -911,6 +911,7 @@ struct inode_operations {
8         int (*create) (struct inode *,struct dentry *,int);
9         int (*create_it) (struct inode *,struct dentry *,int, struct lookup_intent *);
10         struct dentry * (*lookup) (struct inode *,struct dentry *);
11 +       int (*lookup_raw) (struct inode *, const char *, int, ino_t *);
12         struct dentry * (*lookup_it) (struct inode *,struct dentry *, struct lookup_intent *, int flags);
13         int (*link) (struct dentry *,struct inode *,struct dentry *);
14         int (*link_raw) (struct nameidata *,struct nameidata *);
15 --- linux-2.4.18-p4smp1Guser/fs/ext3/namei.c~ext3-raw-lookup    Thu Sep 25 15:59:59 2003
16 +++ linux-2.4.18-p4smp1Guser-pschwan/fs/ext3/namei.c    Thu Sep 25 16:16:48 2003
17 @@ -1121,6 +1121,36 @@ static struct dentry *ext3_lookup(struct
18         return NULL;
19  }
20  
21 +static int ext3_lookup_raw(struct inode *dir, const char *name,
22 +                               int len, ino_t *data)
23 +{
24 +       struct ext3_dir_entry_2 *de;
25 +       struct buffer_head *bh;
26 +       struct dentry parent;
27 +       struct dentry dentry;
28 +       void *lock = NULL;
29 +
30 +       if (len > EXT3_NAME_LEN)
31 +               return -ENAMETOOLONG;
32 +
33 +       parent.d_inode = dir;
34 +       dentry.d_parent = &parent;
35 +       dentry.d_name.name = name;
36 +       dentry.d_name.len = len;
37 +
38 +       bh = ext3_find_entry(&dentry, &de, 0, &lock);
39 +       if (bh) {
40 +               unsigned long ino = le32_to_cpu(de->inode);
41 +               ext3_unlock_htree(dir, lock);
42 +               brelse (bh);
43 +               if (data)
44 +                       *data = ino;
45 +               return 0; /* found name */
46 +       }
47 +
48 +       return -ENOENT;
49 +}
50 +
51  #define S_SHIFT 12
52  static unsigned char ext3_type_by_mode[S_IFMT >> S_SHIFT] = {
53         [S_IFREG >> S_SHIFT]    EXT3_FT_REG_FILE,
54 @@ -2623,6 +2653,7 @@ static inline void ext3_unlock_htree(str
55  struct inode_operations ext3_dir_inode_operations = {
56         create:         ext3_create,            /* BKL held */
57         lookup:         ext3_lookup,            /* BKL held */
58 +       lookup_raw:     ext3_lookup_raw,        /* BKL held */
59         link:           ext3_link,              /* BKL held */
60         unlink:         ext3_unlink,            /* BKL held */
61         symlink:        ext3_symlink,           /* BKL held */
62
63 _