Whamcloud - gitweb
- landing of b_hd_cleanup_merge to HEAD.
[fs/lustre-release.git] / lustre / kernel_patches / patches / ext3-raw-lookup-pdirops-2.4.24.patch
1  fs/ext3/namei.c    |   31 +++++++++++++++++++++++++++++++
2  include/linux/fs.h |    1 +
3  2 files changed, 32 insertions(+)
4
5 Index: lum/include/linux/fs.h
6 ===================================================================
7 --- lum.orig/include/linux/fs.h 2004-06-07 17:52:41.000000000 -0400
8 +++ lum/include/linux/fs.h      2004-06-07 17:56:55.000000000 -0400
9 @@ -904,6 +904,7 @@
10         int (*create) (struct inode *,struct dentry *,int);
11         int (*create_it) (struct inode *,struct dentry *,int, struct lookup_intent *);
12         struct dentry * (*lookup) (struct inode *,struct dentry *);
13 +       int (*lookup_raw) (struct inode *, const char *, int, ino_t *);
14         struct dentry * (*lookup_it) (struct inode *,struct dentry *, struct nameidata *, struct lookup_intent *, int flags);
15         int (*link) (struct dentry *,struct inode *,struct dentry *);
16         int (*link_raw) (struct nameidata *,struct nameidata *);
17 Index: lum/fs/ext3/namei.c
18 ===================================================================
19 --- lum.orig/fs/ext3/namei.c    2004-06-07 17:52:41.000000000 -0400
20 +++ lum/fs/ext3/namei.c 2004-06-07 17:56:31.000000000 -0400
21 @@ -1128,6 +1128,36 @@
22         return iopen_connect_dentry(dentry, inode, 1);
23  }
24  
25 +static int ext3_lookup_raw(struct inode *dir, const char *name,
26 +                               int len, ino_t *data)
27 +{
28 +       struct ext3_dir_entry_2 *de;
29 +       struct buffer_head *bh;
30 +       struct dentry parent;
31 +       struct dentry dentry;
32 +       void *lock = NULL;
33 +
34 +       if (len > EXT3_NAME_LEN)
35 +               return -ENAMETOOLONG;
36 +
37 +       parent.d_inode = dir;
38 +       dentry.d_parent = &parent;
39 +       dentry.d_name.name = name;
40 +       dentry.d_name.len = len;
41 +
42 +       bh = ext3_find_entry(&dentry, &de, 0, &lock);
43 +       if (bh) {
44 +               unsigned long ino = le32_to_cpu(de->inode);
45 +               ext3_unlock_htree(dir, lock);
46 +               brelse (bh);
47 +               if (data)
48 +                       *data = ino;
49 +               return 0; /* found name */
50 +       }
51 +
52 +       return -ENOENT;
53 +}
54 +
55  #define S_SHIFT 12
56  static unsigned char ext3_type_by_mode[S_IFMT >> S_SHIFT] = {
57         [S_IFREG >> S_SHIFT]    EXT3_FT_REG_FILE,
58 @@ -2772,6 +2802,7 @@
59  struct inode_operations ext3_dir_inode_operations = {
60         create:         ext3_create,            /* BKL held */
61         lookup:         ext3_lookup,            /* BKL held */
62 +       lookup_raw:     ext3_lookup_raw,        /* BKL held */
63         link:           ext3_link,              /* BKL held */
64         unlink:         ext3_unlink,            /* BKL held */
65         symlink:        ext3_symlink,           /* BKL held */