Whamcloud - gitweb
- ext3-wantedi patch against 2.6.0-test5
authoralex <alex>
Sun, 28 Sep 2003 10:52:18 +0000 (10:52 +0000)
committeralex <alex>
Sun, 28 Sep 2003 10:52:18 +0000 (10:52 +0000)
lustre/kernel_patches/patches/ext3-wantedi-2.6.patch [new file with mode: 0644]
lustre/kernel_patches/pc/ext3-wantedi-2.6.pc [new file with mode: 0644]

diff --git a/lustre/kernel_patches/patches/ext3-wantedi-2.6.patch b/lustre/kernel_patches/patches/ext3-wantedi-2.6.patch
new file mode 100644 (file)
index 0000000..ce897f5
--- /dev/null
@@ -0,0 +1,192 @@
+ fs/ext3/ialloc.c        |   35 ++++++++++++++++++++++++++++++++++-
+ fs/ext3/ioctl.c         |   25 +++++++++++++++++++++++++
+ fs/ext3/namei.c         |   21 +++++++++++++++++----
+ include/linux/dcache.h  |    5 +++++
+ include/linux/ext3_fs.h |    5 ++++-
+ 5 files changed, 85 insertions(+), 6 deletions(-)
+
+--- linux-2.6.0-test5/fs/ext3/ialloc.c~ext3-wantedi-2.6        2003-06-24 18:05:25.000000000 +0400
++++ linux-2.6.0-test5-alexey/fs/ext3/ialloc.c  2003-09-28 13:40:23.000000000 +0400
+@@ -420,7 +420,8 @@ static int find_group_other(struct super
+  * For other inodes, search forward from the parent directory's block
+  * group to find a free inode.
+  */
+-struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode)
++struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode,
++                              unsigned long goal)
+ {
+       struct super_block *sb;
+       struct buffer_head *bitmap_bh = NULL;
+@@ -448,6 +449,38 @@ struct inode *ext3_new_inode(handle_t *h
+       es = EXT3_SB(sb)->s_es;
+       sbi = EXT3_SB(sb);
++      if (goal) {
++              group = (goal - 1) / EXT3_INODES_PER_GROUP(sb);
++              ino = (goal - 1) % EXT3_INODES_PER_GROUP(sb);
++              gdp = ext3_get_group_desc(sb, group, &bh2);
++
++              err = -EIO;
++              bitmap_bh = read_inode_bitmap (sb, group);
++              if (!bitmap_bh)
++                      goto fail;
++
++              BUFFER_TRACE(bh, "get_write_access");
++              err = ext3_journal_get_write_access(handle, bitmap_bh);
++              if (err) goto fail;
++
++              if (ext3_set_bit_atomic(sb_bgl_lock(sbi, group),
++                                      ino, bitmap_bh->b_data)) {
++                      printk(KERN_ERR "goal inode %lu unavailable\n", goal);
++                      /* Oh well, we tried. */
++                      goto continue_allocation;
++              }
++
++              BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata");
++              err = ext3_journal_dirty_metadata(handle, bitmap_bh);
++              if (err) goto fail;
++
++              /* We've shortcircuited the allocation system successfully,
++               * now finish filling in the inode.
++               */
++              goto got;
++      }
++
++continue_allocation:
+       if (S_ISDIR(mode)) {
+               if (test_opt (sb, OLDALLOC))
+                       group = find_group_dir(sb, dir);
+--- linux-2.6.0-test5/fs/ext3/ioctl.c~ext3-wantedi-2.6 2003-06-24 18:05:25.000000000 +0400
++++ linux-2.6.0-test5-alexey/fs/ext3/ioctl.c   2003-09-28 13:45:54.000000000 +0400
+@@ -24,6 +24,31 @@ int ext3_ioctl (struct inode * inode, st
+       ext3_debug ("cmd = %u, arg = %lu\n", cmd, arg);
+       switch (cmd) {
++      case EXT3_IOC_CREATE_INUM: {
++              char name[32];
++              struct dentry *dchild, *dparent;
++              int rc = 0;
++
++              dparent = list_entry(inode->i_dentry.next, struct dentry,
++                                   d_alias);
++              snprintf(name, sizeof name, "%lu", arg);
++              dchild = lookup_one_len(name, dparent, strlen(name));
++              if (dchild->d_inode) {
++                      printk(KERN_ERR "%*s/%lu already exists (ino %lu)\n",
++                             dparent->d_name.len, dparent->d_name.name, arg,
++                             dchild->d_inode->i_ino);
++                      rc = -EEXIST;
++              } else {
++                      dchild->d_fsdata = (void *)arg;
++                      rc = vfs_create(inode, dchild, 0644, NULL);
++                      if (rc)
++                              printk(KERN_ERR "vfs_create: %d\n", rc);
++                      else if (dchild->d_inode->i_ino != arg)
++                              rc = -EEXIST;
++              }
++              dput(dchild);
++              return rc;
++      }
+       case EXT3_IOC_GETFLAGS:
+               flags = ei->i_flags & EXT3_FL_USER_VISIBLE;
+               return put_user(flags, (int *) arg);
+--- linux-2.6.0-test5/fs/ext3/namei.c~ext3-wantedi-2.6 2003-09-19 18:01:48.000000000 +0400
++++ linux-2.6.0-test5-alexey/fs/ext3/namei.c   2003-09-28 13:40:23.000000000 +0400
+@@ -1617,6 +1617,19 @@ static int ext3_add_nondir(handle_t *han
+       return err;
+ }
++static struct inode * ext3_new_inode_wantedi(handle_t *handle, struct inode *dir,
++                                              int mode, struct dentry *dentry)
++{
++      unsigned long inum = 0;
++
++      if (dentry->d_fsdata != NULL) {
++              struct dentry_params *param =
++                      (struct dentry_params *) dentry->d_fsdata;
++              inum = param->p_inum;
++      }
++      return ext3_new_inode(handle, dir, mode, inum);
++}
++
+ /*
+  * By the time this is called, we already have created
+  * the directory cache entry for the new file, but it
+@@ -1640,7 +1653,7 @@ static int ext3_create (struct inode * d
+       if (IS_DIRSYNC(dir))
+               handle->h_sync = 1;
+-      inode = ext3_new_inode (handle, dir, mode);
++      inode = ext3_new_inode_wantedi (handle, dir, mode, dentry);
+       err = PTR_ERR(inode);
+       if (!IS_ERR(inode)) {
+               inode->i_op = &ext3_file_inode_operations;
+@@ -1670,7 +1683,7 @@ static int ext3_mknod (struct inode * di
+       if (IS_DIRSYNC(dir))
+               handle->h_sync = 1;
+-      inode = ext3_new_inode (handle, dir, mode);
++      inode = ext3_new_inode_wantedi (handle, dir, mode, dentry);
+       err = PTR_ERR(inode);
+       if (!IS_ERR(inode)) {
+               init_special_inode(inode, inode->i_mode, rdev);
+@@ -1702,7 +1715,7 @@ static int ext3_mkdir(struct inode * dir
+       if (IS_DIRSYNC(dir))
+               handle->h_sync = 1;
+-      inode = ext3_new_inode (handle, dir, S_IFDIR | mode);
++      inode = ext3_new_inode_wantedi (handle, dir, S_IFDIR | mode, dentry);
+       err = PTR_ERR(inode);
+       if (IS_ERR(inode))
+               goto out_stop;
+@@ -2094,7 +2107,7 @@ static int ext3_symlink (struct inode * 
+       if (IS_DIRSYNC(dir))
+               handle->h_sync = 1;
+-      inode = ext3_new_inode (handle, dir, S_IFLNK|S_IRWXUGO);
++      inode = ext3_new_inode_wantedi (handle, dir, S_IFLNK|S_IRWXUGO, dentry);
+       err = PTR_ERR(inode);
+       if (IS_ERR(inode))
+               goto out_stop;
+--- linux-2.6.0-test5/include/linux/dcache.h~ext3-wantedi-2.6  2003-09-28 13:40:22.000000000 +0400
++++ linux-2.6.0-test5-alexey/include/linux/dcache.h    2003-09-28 13:40:23.000000000 +0400
+@@ -25,6 +25,11 @@ struct vfsmount;
+ #define IS_ROOT(x) ((x) == (x)->d_parent)
++struct dentry_params {
++      unsigned long   p_inum;
++      void            *p_ptr;
++};
++
+ /*
+  * "quick string" -- eases parameter passing, but more importantly
+  * saves "metadata" about the string (ie length and the hash).
+--- linux-2.6.0-test5/include/linux/ext3_fs.h~ext3-wantedi-2.6 2003-09-19 18:01:10.000000000 +0400
++++ linux-2.6.0-test5-alexey/include/linux/ext3_fs.h   2003-09-28 13:40:23.000000000 +0400
+@@ -203,6 +203,7 @@ struct ext3_group_desc
+ #define       EXT3_IOC_SETFLAGS               _IOW('f', 2, long)
+ #define       EXT3_IOC_GETVERSION             _IOR('f', 3, long)
+ #define       EXT3_IOC_SETVERSION             _IOW('f', 4, long)
++/* EXT3_IOC_CREATE_INUM at bottom of file (visible to kernel and user). */
+ #define       EXT3_IOC_GETVERSION_OLD         _IOR('v', 1, long)
+ #define       EXT3_IOC_SETVERSION_OLD         _IOW('v', 2, long)
+ #ifdef CONFIG_JBD_DEBUG
+@@ -707,7 +708,8 @@ extern int ext3fs_dirhash(const char *na
+                         dx_hash_info *hinfo);
+ /* ialloc.c */
+-extern struct inode * ext3_new_inode (handle_t *, struct inode *, int);
++extern struct inode * ext3_new_inode (handle_t *, struct inode *, int,
++                                    unsigned long);
+ extern void ext3_free_inode (handle_t *, struct inode *);
+ extern struct inode * ext3_orphan_get (struct super_block *, unsigned long);
+ extern unsigned long ext3_count_free_inodes (struct super_block *);
+@@ -792,4 +794,5 @@ extern struct inode_operations ext3_fast
+ #endif        /* __KERNEL__ */
++#define EXT3_IOC_CREATE_INUM                  _IOW('f', 5, long)
+ #endif        /* _LINUX_EXT3_FS_H */
+
+_
diff --git a/lustre/kernel_patches/pc/ext3-wantedi-2.6.pc b/lustre/kernel_patches/pc/ext3-wantedi-2.6.pc
new file mode 100644 (file)
index 0000000..a9b845a
--- /dev/null
@@ -0,0 +1,6 @@
+fs/ext3/ialloc.c
+fs/ext3/inode.c
+fs/ext3/ioctl.c
+fs/ext3/namei.c
+include/linux/dcache.h
+include/linux/ext3_fs.h