Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / kernel_patches / patches / ext3-raw-lookup-2.6.10.patch
1 Index: linux-2.6.10/fs/ext3/namei.c
2 ===================================================================
3 --- linux-2.6.10.orig/fs/ext3/namei.c   2005-05-31 22:20:10.000000000 +0800
4 +++ linux-2.6.10/fs/ext3/namei.c        2005-05-31 22:20:10.000000000 +0800
5 @@ -1178,6 +1178,36 @@
6         return iopen_connect_dentry(dentry, inode, 1);
7  }
8  
9 +static int ext3_lookup_raw(struct inode *dir, const char *name,
10 +                           int len, ino_t *data)
11 +{
12 +       struct ext3_dir_entry_2 *de;
13 +       struct buffer_head *bh;
14 +       struct dentry parent;
15 +       struct dentry dentry;
16 +       void *lock = NULL;
17 +
18 +       if (len > EXT3_NAME_LEN)
19 +               return -ENAMETOOLONG;
20 +
21 +       parent.d_inode = dir;
22 +       dentry.d_parent = &parent;
23 +       dentry.d_name.name = name;
24 +       dentry.d_name.len = len;
25 +
26 +       bh = ext3_find_entry(&dentry, &de, 0, &lock);
27 +       if (bh) {
28 +               unsigned long ino = le32_to_cpu(de->inode);
29 +               ext3_unlock_htree(dir, lock);
30 +               brelse (bh);
31 +               if (data)
32 +                       *data = ino;
33 +               return 0; /* found name */
34 +       }
35 +
36 +       return -ENOENT;
37 +}
38 +
39  
40  struct dentry *ext3_get_parent(struct dentry *child)
41  {
42 @@ -2854,6 +2884,7 @@
43  struct inode_operations ext3_dir_inode_operations = {
44         .create         = ext3_create,
45         .lookup         = ext3_lookup,
46 +       .lookup_raw     = ext3_lookup_raw,
47         .link           = ext3_link,
48         .unlink         = ext3_unlink,
49         .symlink        = ext3_symlink,