include/linux/ext3_fs.h | 2
8 files changed, 318 insertions(+), 2 deletions(-)
---- linux/Documentation/filesystems/ext2.txt~iopen-2.4.20 Wed Jul 11 15:44:45 2001
-+++ linux-mmonroe/Documentation/filesystems/ext2.txt Thu Jul 10 12:28:54 2003
-@@ -35,6 +35,22 @@ resgid=n The group ID which may use th
+Index: lum/Documentation/filesystems/ext2.txt
+===================================================================
+--- lum.orig/Documentation/filesystems/ext2.txt 2001-07-11 16:44:45.000000000 -0600
++++ lum/Documentation/filesystems/ext2.txt 2004-03-09 16:46:38.000000000 -0700
+@@ -35,6 +35,22 @@
sb=n Use alternate superblock at this location.
-+iopen Makes an invisible pseudo-directory called
++iopen Makes an invisible pseudo-directory called
+ __iopen__ available in the root directory
+ of the filesystem. Allows open-by-inode-
+ number. i.e., inode 3145 can be accessed
grpquota,noquota,quota,usrquota Quota options are silently ignored by ext2.
---- linux/fs/ext3/Makefile~iopen-2.4.20 Thu Jul 10 12:28:44 2003
-+++ linux-mmonroe/fs/ext3/Makefile Thu Jul 10 12:28:54 2003
-@@ -11,7 +11,7 @@ O_TARGET := ext3.o
+Index: lum/fs/ext3/Makefile
+===================================================================
+--- lum.orig/fs/ext3/Makefile 2004-01-30 14:54:50.000000000 -0700
++++ lum/fs/ext3/Makefile 2004-03-09 16:46:39.000000000 -0700
+@@ -11,7 +11,7 @@
export-objs := ext3-exports.o
ioctl.o namei.o super.o symlink.o hash.o ext3-exports.o
obj-m := $(O_TARGET)
---- linux/fs/ext3/inode.c~iopen-2.4.20 Thu Jul 10 12:28:46 2003
-+++ linux-mmonroe/fs/ext3/inode.c Thu Jul 10 12:28:54 2003
+Index: lum/fs/ext3/inode.c
+===================================================================
+--- lum.orig/fs/ext3/inode.c 2004-01-30 14:54:55.000000000 -0700
++++ lum/fs/ext3/inode.c 2004-03-09 16:46:41.000000000 -0700
@@ -31,6 +31,7 @@
#include <linux/highuid.h>
#include <linux/quotaops.h>
/*
* SEARCH_FROM_ZERO forces each block allocation to search from the start
-@@ -2253,6 +2254,9 @@ void ext3_read_inode(struct inode * inod
+@@ -2153,6 +2154,9 @@
struct buffer_head *bh;
int block;
+ if (ext3_iopen_get_inode(inode))
+ return;
-+
++
if(ext3_get_inode_loc(inode, &iloc))
goto bad_inode;
bh = iloc.bh;
---- /dev/null Tue Jan 28 04:00:01 2003
-+++ linux-mmonroe/fs/ext3/iopen.c Thu Jul 10 12:28:54 2003
-@@ -0,0 +1,259 @@
+Index: lum/fs/ext3/iopen.c
+===================================================================
+--- lum.orig/fs/ext3/iopen.c 2004-03-09 16:46:37.000000000 -0700
++++ lum/fs/ext3/iopen.c 2004-03-09 16:48:03.000000000 -0700
+@@ -0,0 +1,282 @@
+/*
+ * linux/fs/ext3/iopen.c
+ *
+ * Special support for open by inode number
+ *
+ * Copyright (C) 2001 by Theodore Ts'o (tytso@alum.mit.edu).
-+ *
++ *
+ * This file may be redistributed under the terms of the GNU General
+ * Public License.
-+ *
++ *
+ *
+ * Invariants:
+ * - there is only ever a single DCACHE_NFSD_DISCONNECTED dentry alias
+ struct list_head *lp;
+ struct dentry *alternate;
+ char buf[IOPEN_NAME_LEN];
-+
++
+ if (dentry->d_name.len >= IOPEN_NAME_LEN)
+ return ERR_PTR(-ENAMETOOLONG);
+
+ return ERR_PTR(-ENOENT);
+ }
+
++ assert(list_empty(&dentry->d_alias)); /* d_instantiate */
++ assert(list_empty(&dentry->d_hash)); /* d_rehash */
++
+ /* preferrably return a connected dentry */
+ spin_lock(&dcache_lock);
+ list_for_each(lp, &inode->i_dentry) {
+ }
+
+ if (!list_empty(&inode->i_dentry)) {
-+ alternate = list_entry(inode->i_dentry.next,
++ alternate = list_entry(inode->i_dentry.next,
+ struct dentry, d_alias);
+ dget_locked(alternate);
+ alternate->d_vfs_flags |= DCACHE_REFERENCED;
+ return alternate;
+ }
+ dentry->d_flags |= DCACHE_NFSD_DISCONNECTED;
++
++ /* d_add(), but don't drop dcache_lock before adding dentry to inode */
++ list_add(&dentry->d_alias, &inode->i_dentry); /* d_instantiate */
++ dentry->d_inode = inode;
++
++ __d_rehash(dentry, 0); /* d_rehash */
+ spin_unlock(&dcache_lock);
+
-+ d_add(dentry, inode);
+ return NULL;
+}
+
+{
+ const unsigned char *old_name, *new_name;
+
-+ memcpy(dentry->d_iname, target->d_iname, DNAME_INLINE_LEN);
++ memcpy(dentry->d_iname, target->d_iname, DNAME_INLINE_LEN);
+ old_name = target->d_name.name;
+ new_name = dentry->d_name.name;
+ if (old_name == target->d_iname)
+/* This function is spliced into ext3_lookup and does the move of a
+ * disconnected dentry (if it exists) to a connected dentry.
+ */
-+struct dentry *iopen_connect_dentry(struct dentry *de, struct inode *inode)
++struct dentry *iopen_connect_dentry(struct dentry *dentry, struct inode *inode,
++ int rehash)
+{
+ struct dentry *tmp, *goal = NULL;
+ struct list_head *lp;
+
-+ /* preferrably return a connected dentry */
-+ spin_lock(&dcache_lock);
+ /* verify this dentry is really new */
-+ assert(!de->d_inode);
-+ assert(list_empty(&de->d_subdirs));
-+ assert(list_empty(&de->d_alias));
++ assert(dentry->d_inode == NULL);
++ assert(list_empty(&dentry->d_alias)); /* d_instantiate */
++ if (rehash)
++ assert(list_empty(&dentry->d_hash)); /* d_rehash */
++ assert(list_empty(&dentry->d_subdirs));
+
++ spin_lock(&dcache_lock);
++ if (!inode)
++ goto do_rehash;
+
++ /* preferrably return a connected dentry */
+ list_for_each(lp, &inode->i_dentry) {
+ tmp = list_entry(lp, struct dentry, d_alias);
+ if (tmp->d_flags & DCACHE_NFSD_DISCONNECTED) {
+ }
+ }
+
-+ if (!goal) {
-+ spin_unlock(&dcache_lock);
-+ return NULL;
-+ }
++ if (!goal)
++ goto do_instantiate;
+
+ /* Move the goal to the de hash queue - like d_move() */
+ goal->d_flags &= ~DCACHE_NFSD_DISCONNECTED;
+ list_del_init(&goal->d_hash);
+
+ list_del(&goal->d_child);
-+ list_del(&de->d_child);
++ list_del(&dentry->d_child);
+
+ /* Switch the parents and the names.. */
-+ switch_names(goal, de);
-+ do_switch(goal->d_parent, de->d_parent);
-+ do_switch(goal->d_name.len, de->d_name.len);
-+ do_switch(goal->d_name.hash, de->d_name.hash);
++ switch_names(goal, dentry);
++ do_switch(goal->d_parent, dentry->d_parent);
++ do_switch(goal->d_name.len, dentry->d_name.len);
++ do_switch(goal->d_name.hash, dentry->d_name.hash);
+
+ /* And add them back to the (new) parent lists */
+ list_add(&goal->d_child, &goal->d_parent->d_subdirs);
-+ list_add(&de->d_child, &de->d_parent->d_subdirs);
++ list_add(&dentry->d_child, &dentry->d_parent->d_subdirs);
+ __d_rehash(goal, 0);
+ spin_unlock(&dcache_lock);
++ iput(inode);
+
+ return goal;
++
++ /* d_add(), but don't drop dcache_lock before adding dentry to inode */
++do_instantiate:
++ list_add(&dentry->d_alias, &inode->i_dentry); /* d_instantiate */
++ dentry->d_inode = inode;
++do_rehash:
++ if (rehash)
++ __d_rehash(dentry, 0); /* d_rehash */
++ spin_unlock(&dcache_lock);
++
++ return NULL;
+}
+
+/*
+
+ inode = iget(dir->i_sb, EXT3_BAD_INO);
+
-+ if (!inode)
++ if (!inode)
+ return 0;
+ d_add(dentry, inode);
+ return 1;
+ inode->u.ext3_i.i_dtime = 0;
+ inode->i_blksize = PAGE_SIZE; /* This is the optimal IO size
+ * (for stat), not the fs block
-+ * size */
++ * size */
+ inode->i_blocks = 0;
+ inode->i_version = 1;
+ inode->i_generation = 0;
+
+ return 1;
+}
---- /dev/null Tue Jan 28 04:00:01 2003
-+++ linux-mmonroe/fs/ext3/iopen.h Thu Jul 10 12:28:54 2003
-@@ -0,0 +1,13 @@
+Index: lum/fs/ext3/iopen.h
+===================================================================
+--- lum.orig/fs/ext3/iopen.h 2004-03-09 16:46:37.000000000 -0700
++++ lum/fs/ext3/iopen.h 2004-03-09 16:48:03.000000000 -0700
+@@ -0,0 +1,15 @@
+/*
+ * iopen.h
+ *
+ * Special support for opening files by inode number.
-+ *
++ *
+ * Copyright (C) 2001 by Theodore Ts'o (tytso@alum.mit.edu).
-+ *
++ *
+ * This file may be redistributed under the terms of the GNU General
+ * Public License.
+ */
+
+extern int ext3_check_for_iopen(struct inode *dir, struct dentry *dentry);
+extern int ext3_iopen_get_inode(struct inode *inode);
---- linux/fs/ext3/namei.c~iopen-2.4.20 Thu Jul 10 12:28:46 2003
-+++ linux-mmonroe/fs/ext3/namei.c Thu Jul 10 12:28:54 2003
++extern struct dentry *iopen_connect_dentry(struct dentry *dentry,
++ struct inode *inode, int rehash);
+Index: lum/fs/ext3/namei.c
+===================================================================
+--- lum.orig/fs/ext3/namei.c 2004-01-30 14:54:53.000000000 -0700
++++ lum/fs/ext3/namei.c 2004-03-09 16:49:25.000000000 -0700
@@ -35,7 +35,7 @@
#include <linux/string.h>
#include <linux/locks.h>
/*
* define how far ahead to read directories while searching them.
-@@ -921,16 +921,21 @@ errout:
- return NULL;
- }
- #endif
-+struct dentry *iopen_connect_dentry(struct dentry *de, struct inode *inode);
-
- static struct dentry *ext3_lookup(struct inode * dir, struct dentry *dentry)
- {
- struct inode * inode;
- struct ext3_dir_entry_2 * de;
- struct buffer_head * bh;
-+ struct dentry *alternate = NULL;
-
+@@ -931,6 +931,9 @@
if (dentry->d_name.len > EXT3_NAME_LEN)
return ERR_PTR(-ENAMETOOLONG);
bh = ext3_find_entry(dentry, &de);
inode = NULL;
if (bh) {
-@@ -942,6 +947,12 @@ static struct dentry *ext3_lookup(struct
+@@ -942,8 +945,8 @@
return ERR_PTR(-EACCES);
}
}
+- d_add(dentry, inode);
+- return NULL;
+
-+ if (inode && (alternate = iopen_connect_dentry(dentry, inode))) {
-+ iput(inode);
-+ return alternate;
++ return iopen_connect_dentry(dentry, inode, 1);
+ }
+
+ #define S_SHIFT 12
+@@ -1932,10 +1935,6 @@
+ inode->i_nlink);
+ inode->i_version = ++event;
+ inode->i_nlink = 0;
+- /* There's no need to set i_disksize: the fact that i_nlink is
+- * zero will ensure that the right thing happens during any
+- * recovery. */
+- inode->i_size = 0;
+ ext3_orphan_add(handle, inode);
+ dir->i_nlink--;
+ inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
+@@ -2086,6 +2085,23 @@
+ return err;
+ }
+
++/* Like ext3_add_nondir() except for call to iopen_connect_dentry */
++static int ext3_add_link(handle_t *handle, struct dentry *dentry,
++ struct inode *inode)
++{
++ int err = ext3_add_entry(handle, dentry, inode);
++ if (!err) {
++ err = ext3_mark_inode_dirty(handle, inode);
++ if (err == 0) {
++ (void)iopen_connect_dentry(dentry, inode, 0);
++ return 0;
++ }
+ }
++ ext3_dec_count(handle, inode);
++ iput(inode);
++ return err;
++}
+
- d_add(dentry, inode);
- return NULL;
+ static int ext3_link (struct dentry * old_dentry,
+ struct inode * dir, struct dentry *dentry)
+ {
+@@ -2113,7 +2129,8 @@
+ ext3_inc_count(handle, inode);
+ atomic_inc(&inode->i_count);
+
+- err = ext3_add_nondir(handle, dentry, inode);
++ err = ext3_add_link(handle, dentry, inode);
++ ext3_orphan_del(handle, inode);
+ ext3_journal_stop(handle, dir);
+ return err;
}
---- linux/fs/ext3/super.c~iopen-2.4.20 Thu Jul 10 12:28:45 2003
-+++ linux-mmonroe/fs/ext3/super.c Thu Jul 10 12:28:54 2003
-@@ -835,6 +835,17 @@ static int parse_options (char * options
+Index: lum/fs/ext3/super.c
+===================================================================
+--- lum.orig/fs/ext3/super.c 2004-01-30 14:54:53.000000000 -0700
++++ lum/fs/ext3/super.c 2004-03-09 16:46:45.000000000 -0700
+@@ -742,6 +742,18 @@
|| !strcmp (this_char, "quota")
|| !strcmp (this_char, "usrquota"))
/* Don't do anything ;-) */ ;
+ else if (!strcmp (this_char, "iopen")) {
+ set_opt (sbi->s_mount_opt, IOPEN);
+ clear_opt (sbi->s_mount_opt, IOPEN_NOPRIV);
-+ } else if (!strcmp (this_char, "noiopen")) {
++ }
++ else if (!strcmp (this_char, "noiopen")) {
+ clear_opt (sbi->s_mount_opt, IOPEN);
+ clear_opt (sbi->s_mount_opt, IOPEN_NOPRIV);
+ }
else if (!strcmp (this_char, "journal")) {
/* @@@ FIXME */
/* Eventually we will want to be able to create
---- linux/include/linux/ext3_fs.h~iopen-2.4.20 Thu Jul 10 12:28:46 2003
-+++ linux-mmonroe/include/linux/ext3_fs.h Thu Jul 10 12:30:12 2003
-@@ -322,6 +322,8 @@ struct ext3_inode {
+Index: lum/include/linux/ext3_fs.h
+===================================================================
+--- lum.orig/include/linux/ext3_fs.h 2004-01-30 14:54:53.000000000 -0700
++++ lum/include/linux/ext3_fs.h 2004-03-09 16:46:46.000000000 -0700
+@@ -322,6 +322,8 @@
#define EXT3_MOUNT_UPDATE_JOURNAL 0x1000 /* Update the journal format */
#define EXT3_MOUNT_NO_UID32 0x2000 /* Disable 32-bit UIDs */
#define EXT3_MOUNT_XATTR_USER 0x4000 /* Extended user attributes */
#define EXT3_MOUNT_ASYNCDEL 0x20000 /* Delayed deletion */
/* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
-
-_