[AUFS PATCH v2.6.26-rc2-mm1 24/39] aufs inode

Previous thread: Re: [PATCH] ata: fix sleep-while-holding-spinlock in sata_nv by Robert Hancock on Tuesday, May 20, 2008 - 7:17 pm. (4 messages)

Next thread: pull request: wireless-2.6 2008-05-20 by John W. Linville on Tuesday, May 20, 2008 - 7:57 pm. (2 messages)
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

I have posted some of ideas, design or approaches which are implemented
in AUFS stackable filesystem about a month before.
While I have a plan to implement some more features still, the current
AUFS status is better and used many people for years.
Since I have received requests to submit AUFS into the mainline more
than once, Now I'd ask you to include AUFS into mainline.

After last posts last week, I received several review comments and fixed
several things.
Thank you all reviewers.

- grouping/folding some files into a single patch (67 --> 39 patches)
- more description texts
- refine and remove some obsoleted lines from fs/aufs/Kconfig, Makefile,
  fs/aufs/aufs.h, fs/aufs/module.c, and
  Documentation/filesystems/aufs/README.
- new file Documentation/filesystems/aufs/Design
- new configuration AUFS_HIN_OR_DLGT
- convert '//' comment style into '/* */'
- remove some lines for local test and debugging

----------------------------------------------------------------------

Junjiro Okajima (39):
  aufs documents
  aufs manual
  aufs configuration and Makefile
  aufs module global
  aufs super_block
  aufs branch directory/filesystem
  aufs xino
  aufs branch filesystem type specific
  aufs object lifetime management via sysfs
  aufs mount options/flags
  aufs workqueue
  aufs sub-VFS
  aufs sub-dcache
  aufs copy-up
  aufs whiteout
  aufs pseudo-link
  aufs policies to select one among multiple writable branches
  aufs dentry (main lookup)
  aufs dentry (except lookup)
  aufs file
  aufs file (vm op)
  aufs direcotry
  aufs virtual or vertical(stacked) directory
  aufs inode
  aufs inode add operations
  aufs inode del operations
  aufs inode rename operation
  aufs inode other operations
  aufs lower inode and internal inotify
  aufs delegate mode
  aufs lower inode and delegate-mode
  aufs export via NFS
  aufs robr-mode
  aufs sysfs entries
  aufs misc functions
  aufs debug print and magic sysrq
  ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

	initial commit
	aufs documents

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 Documentation/filesystems/aufs/Design |  311 +++++++++++++++++++++++++++++++++
 Documentation/filesystems/aufs/README |  152 ++++++++++++++++
 2 files changed, 463 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/filesystems/aufs/Design
 create mode 100644 Documentation/filesystems/aufs/README

diff --git a/Documentation/filesystems/aufs/Design b/Documentation/filesystems/aufs/Design
new file mode 100644
index 0000000..d6276dd
--- /dev/null
+++ b/Documentation/filesystems/aufs/Design
@@ -0,0 +1,311 @@
+
+This file is equivalent to the past mail messages, titled
+"AUFS: merging/stacking several filesystems"
+which were posted to linux-fsdevel ML in Apr 2008.
+
+Junjiro Okajima
+
+----------------------------------------------------------------------
+
+Hello fs-developers,
+
+I am developing a stackable unification filesystem which unifies several
+directories and provides a merged single directory.
+I guess most people already knows what it is. When users access a file,
+the access will be passed/re-directed/converted (sorry, I am not sure
+which English word is correct) to the real file on the member
+filesystem. The member filesystem is called 'lower filesytstem' or
+'branch' and has a mode 'readonly' and 'readwrite.' And the file
+deletion is handled as 'whiteout' on the upper writable branch.
+
+On this ML, there have been discussions about UnionMount (Jan Blunck
+and Bharata B Rao) and Unionfs (Erez Zadok). They took different
+approaches to implement the merged-view.
+The former tries putting it into VFS, and the latter implements as a
+separate filesystem.
+(If I misunderstand about these implementations, please let me know and
+I shall correct it. Because it is a long time ago when I read their
+source files last time.)
+UnionMount's approach will be able to small, but may be hard to share
+branches ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:23 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

- incorporate fs/aufs
- export __lookup_hash()
- make lockdep deeper for debugging locks in a stackble fs

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/Kconfig              |    2 ++
 fs/Makefile             |    1 +
 fs/namei.c              |    2 +-
 include/linux/lockdep.h |    4 ++++
 include/linux/namei.h   |    1 +
 5 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/fs/Kconfig b/fs/Kconfig
index 9178d9f..19550b5 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -1074,6 +1074,8 @@ config UNION_FS_DEBUG
 	help
 	  If you say Y here, you can turn on debugging output from Unionfs.
 
+source "fs/aufs/Kconfig"
+
 endmenu
 
 menu "Miscellaneous filesystems"
diff --git a/fs/Makefile b/fs/Makefile
index aa676d3..7d80668 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -125,3 +125,4 @@ obj-$(CONFIG_HPPFS)		+= hppfs/
 obj-$(CONFIG_DEBUG_FS)		+= debugfs/
 obj-$(CONFIG_OCFS2_FS)		+= ocfs2/
 obj-$(CONFIG_GFS2_FS)           += gfs2/
+obj-$(CONFIG_AUFS)              += aufs/
diff --git a/fs/namei.c b/fs/namei.c
index 8e2292c..2978030 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1296,7 +1296,7 @@ int __user_path_lookup_open(const char __user *name, unsigned int lookup_flags,
 	return err;
 }
 
-static struct dentry *__lookup_hash(struct qstr *name,
+struct dentry *__lookup_hash(struct qstr *name,
 		struct dentry *base, struct nameidata *nd)
 {
 	struct dentry *dentry;
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 4c4d236..f5d0642 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -58,7 +58,11 @@ enum lock_usage_bit
 #define LOCKF_USED_IN_IRQ_READ \
 		(LOCKF_USED_IN_HARDIRQ_READ | LOCKF_USED_IN_SOFTIRQ_READ)
 
+#ifdef CONFIG_AUFS
+#define MAX_LOCKDEP_SUBCLASSES		16UL
+#else
 #define MAX_LOCKDEP_SUBCLASSES		8UL
+#endif
 
 /*
  * Lock-classes are keyed via unique addresses, by embedding the
diff --git a/include/linux/namei.h ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:23 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
debug print functions and magic sysrq handler

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/debug.c |  466 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 fs/aufs/debug.h |  208 +++++++++++++++++++++++++
 fs/aufs/sysrq.c |  101 ++++++++++++
 3 files changed, 775 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/debug.c
 create mode 100644 fs/aufs/debug.h
 create mode 100644 fs/aufs/sysrq.c

diff --git a/fs/aufs/debug.c b/fs/aufs/debug.c
new file mode 100644
index 0000000..f2b2b01
--- /dev/null
+++ b/fs/aufs/debug.c
@@ -0,0 +1,466 @@
+/*
+ * Copyright (C) 2005-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * debug print functions
+ */
+
+#include "aufs.h"
+
+atomic_t au_cond = ATOMIC_INIT(0);
+
+char *au_plevel = KERN_DEBUG;
+#define dpri(fmt, arg...) do { \
+	if (LktrCond) \
+		printk("%s" fmt, au_plevel, ##arg); \
+} while (0)
+
+/* ---------------------------------------------------------------------- */
+
+void au_dpri_whlist(struct au_nhash *whlist)
+{
+	int i;
+	struct hlist_head *head;
+	struct au_vdir_wh *tpos;
+	struct hlist_node *pos;
+
+	for (i = 0; i < AuSize_NHASH; i++) {
+		head = whlist->heads + ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:23 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
aufs as a readonly branch of another aufs

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/robr.c |  109 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 109 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/robr.c

diff --git a/fs/aufs/robr.c b/fs/aufs/robr.c
new file mode 100644
index 0000000..64ec128
--- /dev/null
+++ b/fs/aufs/robr.c
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * 'robr', aufs as readonly branch of another aufs
+ */
+
+#include "aufs.h"
+
+/* ---------------------------------------------------------------------- */
+
+int au_test_robr_wh(struct qstr *name, struct dentry *h_parent,
+		    struct qstr *wh_name, int try_sio, struct au_ndx *ndx)
+{
+	if (strncmp(name->name, AUFS_WH_PFX, AUFS_WH_PFX_LEN))
+		return au_wh_test(h_parent, wh_name, try_sio, ndx);
+	return -EPERM;
+}
+
+int au_test_robr_shwh(struct super_block *sb, const struct qstr *name)
+{
+	return 0;
+}
+
+/* ---------------------------------------------------------------------- */
+
+struct au_robr_lvma {
+	struct list_head list;
+	struct vm_area_struct *vma;
+};
+
+struct file ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:23 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
NFS exporting

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/export.c |  578 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 578 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/export.c

diff --git a/fs/aufs/export.c b/fs/aufs/export.c
new file mode 100644
index 0000000..13b7b67
--- /dev/null
+++ b/fs/aufs/export.c
@@ -0,0 +1,578 @@
+/*
+ * Copyright (C) 2007-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * export via nfs
+ */
+
+#include <linux/exportfs.h>
+#include "aufs.h"
+
+union conv {
+#if BITS_PER_LONG == 32
+	__u32 a[1];
+#else
+	__u32 a[2];
+#endif
+	ino_t ino;
+};
+
+static ino_t decode_ino(__u32 *a)
+{
+	union conv u;
+
+	u.a[0] = a[0];
+#if BITS_PER_LONG == 64
+	u.a[1] = a[1];
+#endif
+	return u.ino;
+}
+
+static void encode_ino(__u32 *a, ino_t ino)
+{
+	union conv u;
+
+	u.ino = ino;
+	a[0] = u.a[0];
+#if BITS_PER_LONG == 64
+	a[1] = u.a[1];
+#endif
+}
+
+/* NFS file handle */
+enum {
+	Fh_br_id,
+	Fh_sigen,
+#if BITS_PER_LONG == 64
+	/* support 64bit inode number ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
inode del operations (unlink/rmdir)

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/i_op_del.c |  562 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 562 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/i_op_del.c

diff --git a/fs/aufs/i_op_del.c b/fs/aufs/i_op_del.c
new file mode 100644
index 0000000..66eab04
--- /dev/null
+++ b/fs/aufs/i_op_del.c
@@ -0,0 +1,562 @@
+/*
+ * Copyright (C) 2005-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * inode operations (del entry)
+ */
+
+#include "aufs.h"
+
+/* returns,
+ * 0: wh is unnecessary
+ * plus: wh is necessary
+ * minus: error
+ */
+int au_wr_dir_need_wh(struct dentry *dentry, int isdir, aufs_bindex_t *bcpup,
+		      struct dentry *locked)
+{
+	int need_wh, err;
+	aufs_bindex_t bstart;
+	struct dentry *h_dentry;
+	struct super_block *sb;
+
+	LKTRTrace("%.*s, isdir %d, *bcpup %d, locked %p\n",
+		  AuDLNPair(dentry), isdir, *bcpup, locked);
+	sb = dentry->d_sb;
+
+	bstart = au_dbstart(dentry);
+	LKTRTrace("bcpup %d, bstart %d\n", *bcpup, bstart);
+	h_dentry = au_h_dptr(dentry, bstart);
+	if (*bcpup < 0) {
+		*bcpup = bstart;
+		if (au_test_ro(sb, bstart, dentry->d_inode)) ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:23 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
'delegate' is a special mode for people who don't want their application
to access branches through aufs or to be traced strictly by task I/O
accounting. Also it will be helpful for LSM users, because the internal
access from aufs to branches may be detected, reported or prohibited by
LSM. in 'delegate' mode, aufs passes the internal access to the aufs
kernel thread.

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/dlgt.c |  110 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 110 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/dlgt.c

diff --git a/fs/aufs/dlgt.c b/fs/aufs/dlgt.c
new file mode 100644
index 0000000..9fb25b7
--- /dev/null
+++ b/fs/aufs/dlgt.c
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * lookup functions in 'delegate' mode
+ */
+
+#include "aufs.h"
+
+/* ---------------------------------------------------------------------- */
+
+struct au_lookup_one_len_args {
+	struct dentry **errp;
+	const char *name;
+	struct dentry *parent;
+	int len;
+};
+
+static void au_call_lookup_one_len(void *args)
+{
+	struct au_lookup_one_len_args *a = args;
+	*a->errp = ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
inode add operations (mknod/creat/link/mkdir)

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/i_op_add.c |  765 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 765 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/i_op_add.c

diff --git a/fs/aufs/i_op_add.c b/fs/aufs/i_op_add.c
new file mode 100644
index 0000000..471a31f
--- /dev/null
+++ b/fs/aufs/i_op_add.c
@@ -0,0 +1,765 @@
+/*
+ * Copyright (C) 2005-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * inode operations (add entry)
+ */
+
+#include "aufs.h"
+
+/*
+ * final procedure of adding a new entry, except link(2).
+ * remove whiteout, instantiate, copyup the parent dir's times and size
+ * and update version.
+ * if it failed, re-create the removed whiteout.
+ */
+static int epilog(struct inode *dir, struct dentry *wh_dentry,
+		  struct dentry *dentry)
+{
+	int err, rerr;
+	aufs_bindex_t bwh;
+	struct inode *inode, *h_dir;
+	struct dentry *wh;
+	struct au_ndx ndx;
+	struct super_block *sb;
+
+	LKTRTrace("wh %p, %.*s\n", wh_dentry, AuDLNPair(dentry));
+
+	bwh = -1;
+	if (wh_dentry) {
+		h_dir = wh_dentry->d_parent->d_inode; /* dir inode is locked ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:23 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
sysfs entries, compiled only when CONFIG_SYSFS is enabled

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/sysfs.c |  353 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 353 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/sysfs.c

diff --git a/fs/aufs/sysfs.c b/fs/aufs/sysfs.c
new file mode 100644
index 0000000..63cffe7
--- /dev/null
+++ b/fs/aufs/sysfs.c
@@ -0,0 +1,353 @@
+/*
+ * Copyright (C) 2007-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * sysfs interface
+ */
+
+#include <linux/fs.h>
+#include <linux/module.h>
+#include <linux/seq_file.h>
+#include <linux/sysfs.h>
+#include "aufs.h"
+
+
+#ifdef CONFIG_AUFS_STAT
+static ssize_t stat_show(struct kobject *kobj, struct kobj_attribute *attr,
+			 char *buf)
+{
+	char *p = buf;
+	const char *end = buf + PAGE_SIZE;
+	int i;
+
+	p += snprintf(p, end - p, "wkq max_busy:");
+	for (i = 0; p < end && i < aufs_nwkq; i++)
+		p += snprintf(p, end - p, " %u", au_wkq[i].max_busy);
+	if (p < end)
+		p += snprintf(p, end - p, ", %u(generic)\n",
+			      au_wkq[aufs_nwkq].max_busy);
+
+	if (p < end)
+		return p - buf;
+	else
+		return -EFBIG;
+}
+
+static struct kobj_attribute ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
inode functions and private data

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/iinfo.c |  275 ++++++++++++++++++++++++++++++++++++++
 fs/aufs/inode.c |  400 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 fs/aufs/inode.h |  334 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 1009 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/iinfo.c
 create mode 100644 fs/aufs/inode.c
 create mode 100644 fs/aufs/inode.h

diff --git a/fs/aufs/iinfo.c b/fs/aufs/iinfo.c
new file mode 100644
index 0000000..f9230a9
--- /dev/null
+++ b/fs/aufs/iinfo.c
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2005-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * inode private data
+ */
+
+#include "aufs.h"
+
+struct au_iinfo *au_ii(struct inode *inode)
+{
+	struct au_iinfo *iinfo;
+
+	iinfo = &(container_of(inode, struct aufs_icntnr, vfs_inode)->iinfo);
+	/* bad_inode case */
+	if (unlikely(!iinfo->ii_hinode))
+		return NULL;
+	AuDebugOn(!iinfo->ii_hinode
+		  /* || au_sbi(inode->i_sb)->si_bend < iinfo->ii_bend */
+		  || iinfo->ii_bend < iinfo->ii_bstart);
+	return iinfo;
+}
+
+struct inode *au_h_iptr(struct inode *inode, aufs_bindex_t bindex)
+{
+	struct ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
inode other operations
(permission/lookup/setattr/readlink/follow_link/put_link)

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/i_op.c |  728 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 728 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/i_op.c

diff --git a/fs/aufs/i_op.c b/fs/aufs/i_op.c
new file mode 100644
index 0000000..deb25d8
--- /dev/null
+++ b/fs/aufs/i_op.c
@@ -0,0 +1,728 @@
+/*
+ * Copyright (C) 2005-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * inode operations (except add/del/rename)
+ */
+
+#include <linux/fs_stack.h>
+#include <linux/uaccess.h>
+#include "aufs.h"
+
+static int h_permission(struct inode *h_inode, int mask,
+			struct nameidata *fake_nd, int brperm, int dlgt)
+{
+	int err, submask;
+	const int write_mask = (mask & (MAY_WRITE | MAY_APPEND));
+
+	LKTRTrace("ino %lu, mask 0x%x, brperm 0x%x\n",
+		  h_inode->i_ino, mask, brperm);
+
+	err = -EACCES;
+	if (unlikely((write_mask && IS_IMMUTABLE(h_inode))
+		     || ((mask & MAY_EXEC) && S_ISREG(h_inode->i_mode)
+			 && fake_nd && fake_nd->path.mnt
+			 && (fake_nd->path.mnt->mnt_flags & MNT_NOEXEC))
+		    ))
+		goto out;
+
+	/* skip hidden ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
pseudo-link is a logical hardlink over branches or different filesystems.

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/plink.c |  344 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 344 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/plink.c

diff --git a/fs/aufs/plink.c b/fs/aufs/plink.c
new file mode 100644
index 0000000..7197d7c
--- /dev/null
+++ b/fs/aufs/plink.c
@@ -0,0 +1,344 @@
+/*
+ * Copyright (C) 2007-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * pseudo-link
+ */
+
+#include "aufs.h"
+
+struct pseudo_link {
+	struct list_head list;
+	struct inode *inode;
+};
+
+#ifdef CONFIG_AUFS_DEBUG
+void au_plink_list(struct super_block *sb)
+{
+	struct au_sbinfo *sbinfo;
+	struct list_head *plink_list;
+	struct pseudo_link *plink;
+
+	AuTraceEnter();
+	SiMustAnyLock(sb);
+	sbinfo = au_sbi(sb);
+	AuDebugOn(!au_opt_test(au_mntflags(sb), PLINK));
+
+	plink_list = &sbinfo->si_plink;
+	spin_lock(&sbinfo->si_plink_lock);
+	list_for_each_entry(plink, plink_list, list)
+		AuDbg("%lu\n", plink->inode->i_ino);
+	spin_unlock(&sbinfo->si_plink_lock);
+}
+#endif
+
+int au_plink_test(struct super_block *sb, struct inode ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
directory operations

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/dir.c |  548 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 fs/aufs/dir.h |  145 +++++++++++++++
 2 files changed, 693 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/dir.c
 create mode 100644 fs/aufs/dir.h

diff --git a/fs/aufs/dir.c b/fs/aufs/dir.c
new file mode 100644
index 0000000..c4e328d
--- /dev/null
+++ b/fs/aufs/dir.c
@@ -0,0 +1,548 @@
+/*
+ * Copyright (C) 2005-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * directory operations
+ */
+
+#include <linux/fs_stack.h>
+#include "aufs.h"
+
+static int reopen_dir(struct file *file)
+{
+	int err;
+	struct dentry *dentry, *h_dentry;
+	aufs_bindex_t bindex, btail, bstart;
+	struct file *h_file;
+
+	dentry = file->f_dentry;
+	LKTRTrace("%.*s\n", AuDLNPair(dentry));
+	AuDebugOn(!S_ISDIR(dentry->d_inode->i_mode));
+
+	/* open all hidden dirs */
+	bstart = au_dbstart(dentry);
+#if 1 /* todo: necessary? */
+	for (bindex = au_fbstart(file); bindex < bstart; bindex++)
+		au_set_h_fptr(file, bindex, NULL);
+#endif
+	au_set_fbstart(file, bstart);
+	btail = au_dbtaildir(dentry);
+#if 1 /* todo: necessary? */
+	for (bindex = ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
whiteout for logical deletion and opaque directory

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/whout.c | 1026 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 fs/aufs/whout.h |  138 ++++++++
 2 files changed, 1164 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/whout.c
 create mode 100644 fs/aufs/whout.h

diff --git a/fs/aufs/whout.c b/fs/aufs/whout.c
new file mode 100644
index 0000000..4b18a3f
--- /dev/null
+++ b/fs/aufs/whout.c
@@ -0,0 +1,1026 @@
+/*
+ * Copyright (C) 2005-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * whiteout for logical deletion and opaque directory
+ */
+
+#include <linux/fs.h>
+#include <linux/namei.h>
+#include "aufs.h"
+
+#define WH_MASK			S_IRUGO
+
+/* If a directory contains this file, then it is opaque.  We start with the
+ * .wh. flag so that it is blocked by lookup.
+ */
+static struct qstr diropq_name = {
+	.name = AUFS_WH_DIROPQ,
+	.len = sizeof(AUFS_WH_DIROPQ) - 1
+};
+
+/*
+ * generate whiteout name, which is NOT terminated by NULL.
+ * @name: original d_name.name
+ * @len: original d_name.len
+ * @wh: whiteout qstr
+ * returns zero when succeeds, otherwise error.
+ * succeeded value as wh->name ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
handling mount options/flags

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/opts.c | 1492 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 fs/aufs/opts.h |  243 +++++++++
 2 files changed, 1735 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/opts.c
 create mode 100644 fs/aufs/opts.h

diff --git a/fs/aufs/opts.c b/fs/aufs/opts.c
new file mode 100644
index 0000000..ca897a8
--- /dev/null
+++ b/fs/aufs/opts.c
@@ -0,0 +1,1492 @@
+/*
+ * Copyright (C) 2005-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * mount options/flags
+ */
+
+#include <linux/types.h> /* a distribution requires */
+#include <linux/parser.h>
+#include "aufs.h"
+
+/* ---------------------------------------------------------------------- */
+
+enum {
+	Opt_br,
+	Opt_add, Opt_del, Opt_mod, Opt_reorder, Opt_append, Opt_prepend,
+	Opt_idel, Opt_imod, Opt_ireorder,
+	Opt_dirwh, Opt_rdcache, Opt_deblk, Opt_nhash, Opt_rendir,
+	Opt_xino, Opt_zxino, Opt_noxino,
+	Opt_trunc_xino, Opt_trunc_xino_v, Opt_notrunc_xino,
+	Opt_trunc_xino_path, Opt_itrunc_xino,
+	Opt_xinodir, Opt_xinonames, Opt_ixinonames,
+	Opt_trunc_xib, Opt_notrunc_xib,
+	Opt_dirperm1, Opt_nodirperm1,
+	Opt_shwh, ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
file private data and address_space operations

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/file.c  |  747 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 fs/aufs/file.h  |  223 +++++++++++++++++
 fs/aufs/finfo.c |  182 ++++++++++++++
 3 files changed, 1152 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/file.c
 create mode 100644 fs/aufs/file.h
 create mode 100644 fs/aufs/finfo.c

diff --git a/fs/aufs/file.c b/fs/aufs/file.c
new file mode 100644
index 0000000..13bc36d
--- /dev/null
+++ b/fs/aufs/file.c
@@ -0,0 +1,747 @@
+/*
+ * Copyright (C) 2005-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * handling file/dir, and address_space operation
+ */
+
+#include <linux/pagemap.h>
+#include "aufs.h"
+
+/*
+ * a dirty trick for handling FMODE_EXEC and deny_write_access().
+ * because FMODE_EXEC flag is not passed to f_op->open(),
+ * set it to file->private_data temporary.
+ */
+int au_store_fmode_exec(struct nameidata *nd, struct inode *inode)
+{
+	int err;
+	union {
+		void *p;
+		unsigned long ul;
+	} u;
+
+	err = 0;
+	if (nd
+	    && (nd->flags & LOOKUP_OPEN)
+	    && nd->intent.open.file
+	    && (nd->intent.open.flags & ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
external inode number translation table and bitmap

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/xino.c | 1212 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 1212 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/xino.c

diff --git a/fs/aufs/xino.c b/fs/aufs/xino.c
new file mode 100644
index 0000000..eb5bdff
--- /dev/null
+++ b/fs/aufs/xino.c
@@ -0,0 +1,1212 @@
+/*
+ * Copyright (C) 2005-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * external inode number translation table and bitmap
+ */
+
+#include <linux/uaccess.h>
+#include "aufs.h"
+
+/* ---------------------------------------------------------------------- */
+
+static ssize_t xino_fread(au_readf_t func, struct file *file, void *buf,
+			  size_t size, loff_t *pos)
+{
+	ssize_t err;
+	mm_segment_t oldfs;
+
+	LKTRTrace("%.*s, sz %lu, *pos %Ld\n",
+		  AuDLNPair(file->f_dentry), (unsigned long)size, *pos);
+
+	oldfs = get_fs();
+	set_fs(KERNEL_DS);
+	do {
+		/* todo: signal_pending? */
+		err = func(file, (char __user *)buf, size, pos);
+	} while (err == -EAGAIN || err == -EINTR);
+	set_fs(oldfs);
+
+#if 0 /* reserved for future use */
+	if (err > ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
super_block operations and private data

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/sbinfo.c |  261 +++++++++++++++++
 fs/aufs/super.c  |  835 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 fs/aufs/super.h  |  405 ++++++++++++++++++++++++++
 3 files changed, 1501 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/sbinfo.c
 create mode 100644 fs/aufs/super.c
 create mode 100644 fs/aufs/super.h

diff --git a/fs/aufs/sbinfo.c b/fs/aufs/sbinfo.c
new file mode 100644
index 0000000..0609411
--- /dev/null
+++ b/fs/aufs/sbinfo.c
@@ -0,0 +1,261 @@
+/*
+ * Copyright (C) 2005-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * superblock private data
+ */
+
+#include <linux/mnt_namespace.h>
+#include <linux/smp_lock.h>
+#include "aufs.h"
+
+/*
+ * they are necessary regardless sysfs is disabled.
+ */
+void au_si_free(struct kobject *kobj)
+{
+	struct au_sbinfo *sbinfo;
+	struct super_block *sb;
+
+	LKTRTrace("kobj %p\n", kobj);
+	sbinfo = container_of(kobj, struct au_sbinfo, si_kobj);
+	LKTRTrace("sbinfo %p\n", sbinfo);
+	AuDebugOn(!list_empty(&sbinfo->si_plink));
+
+	sb = sbinfo->si_sb;
+	if (unlikely(!au_ftest_si(sbinfo, FAILED_INIT))) ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:23 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
they will be written all in C in the future.
mount.aufs		mount helper script
auplink			pseudo-link helper script
aulchown.c		pseudo-link helper for symlink
umount.aufs		umount helper script

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 Documentation/filesystems/aufs/aulchown.c  |   28 ++++
 Documentation/filesystems/aufs/auplink     |  168 +++++++++++++++++++++++
 Documentation/filesystems/aufs/mount.aufs  |  203 ++++++++++++++++++++++++++++
 Documentation/filesystems/aufs/umount.aufs |   31 +++++
 4 files changed, 430 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/filesystems/aufs/aulchown.c
 create mode 100644 Documentation/filesystems/aufs/auplink
 create mode 100644 Documentation/filesystems/aufs/mount.aufs
 create mode 100644 Documentation/filesystems/aufs/umount.aufs

diff --git a/Documentation/filesystems/aufs/aulchown.c b/Documentation/filesystems/aufs/aulchown.c
new file mode 100644
index 0000000..eb09270
--- /dev/null
+++ b/Documentation/filesystems/aufs/aulchown.c
@@ -0,0 +1,28 @@
+
+/*
+ * While this tool should be atomic, I choose loose/rough way.
+ * cf. auplink and aufs.5
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+	int err, nerr;
+	struct stat st;
+
+	nerr = 0;
+	while (*++argv) {
+		err = lstat(*argv, &st);
+		if (!err && S_ISLNK(st.st_mode))
+			err = lchown(*argv, st.st_uid, st.st_gid);
+		if (!err)
+			continue;
+		perror(*argv);
+		nerr++;
+	}
+	return nerr;
+}
diff --git a/Documentation/filesystems/aufs/auplink b/Documentation/filesystems/aufs/auplink
new file mode 100644
index 0000000..dec6ee9
--- /dev/null
+++ b/Documentation/filesystems/aufs/auplink
@@ -0,0 +1,168 @@
+#!/bin/sh
+
+# Copyright (C) 2006, 2007, 2008 Junjiro Okajima
+#
+# This program, aufs is free software; you can redistribute it and/or modify
+# it under the terms of the ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:23 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
misc functions

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/misc.c |  266 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 fs/aufs/misc.h |  201 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 467 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/misc.c
 create mode 100644 fs/aufs/misc.h

diff --git a/fs/aufs/misc.c b/fs/aufs/misc.c
new file mode 100644
index 0000000..9c5694c
--- /dev/null
+++ b/fs/aufs/misc.c
@@ -0,0 +1,266 @@
+/*
+ * Copyright (C) 2005-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ *
+ */
+
+#include "aufs.h"
+
+void *au_kzrealloc(void *p, unsigned int nused, unsigned int new_sz, gfp_t gfp)
+{
+	void *q;
+
+	LKTRTrace("p %p, nused %d, sz %d\n", p, nused, new_sz);
+	AuDebugOn(new_sz <= 0);
+	if (new_sz <= nused)
+		return p;
+
+	q = krealloc(p, new_sz, gfp);
+	if (q)
+		memset(q + nused, 0, new_sz - nused);
+	return q;
+}
+
+/* ---------------------------------------------------------------------- */
+
+struct nameidata *au_dup_nd(struct au_sbinfo *sbinfo, struct nameidata *dst,
+			    struct nameidata *src)
+{
+	LKTRTrace("src %p\n", src);
+
+	if (src) {
+		*dst = *src;
+		dst->flags &= ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:23 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

	initial commit
	aufs global header file

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 include/linux/aufs_type.h |  111 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 111 insertions(+), 0 deletions(-)
 create mode 100644 include/linux/aufs_type.h

diff --git a/include/linux/aufs_type.h b/include/linux/aufs_type.h
new file mode 100644
index 0000000..f69fb16
--- /dev/null
+++ b/include/linux/aufs_type.h
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2005, 2006, 2007, 2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include <linux/ioctl.h>
+
+#ifndef __AUFS_TYPE_H__
+#define __AUFS_TYPE_H__
+
+#define AUFS_VERSION	"20080521-mm"
+
+/* move this to linux-2.6.19/include/magic.h */
+#define AUFS_SUPER_MAGIC	('a' << 24 | 'u' << 16 | 'f' << 8 | 's')
+
+/* ---------------------------------------------------------------------- */
+
+#ifdef CONFIG_AUFS_BRANCH_MAX_127
+/* some environments treat 'char' as 'unsigned char' by default */
+typedef signed char aufs_bindex_t;
+#define AUFS_BRANCH_MAX 127
+#else
+typedef short aufs_bindex_t;
+#ifdef CONFIG_AUFS_BRANCH_MAX_511
+#define AUFS_BRANCH_MAX 511
+#elif defined(CONFIG_AUFS_BRANCH_MAX_1023)
+#define AUFS_BRANCH_MAX 1023
+#elif ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
handles inodes on lower/branch filesystem, including internal
inotify-watch

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/hinode.h   |  184 +++++++++
 fs/aufs/hinotify.c | 1059 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 1243 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/hinode.h
 create mode 100644 fs/aufs/hinotify.c

diff --git a/fs/aufs/hinode.h b/fs/aufs/hinode.h
new file mode 100644
index 0000000..73933da
--- /dev/null
+++ b/fs/aufs/hinode.h
@@ -0,0 +1,184 @@
+/*
+ * Copyright (C) 2005-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * lower (branch filesystem) inode and setting inotify
+ */
+
+#ifndef __AUFS_HINODE_H__
+#define __AUFS_HINODE_H__
+
+#ifdef __KERNEL__
+
+#include <linux/fs.h>
+#include <linux/inotify.h>
+#include <linux/aufs_type.h>
+#include "super.h"
+#include "vfsub.h"
+
+/* ---------------------------------------------------------------------- */
+
+struct au_hinotify {
+#ifdef CONFIG_AUFS_HINOTIFY
+	struct inotify_watch	hin_watch;
+	struct inode		*hin_aufs_inode;	/* no get/put */
+
+	/* an array of atomic_t X au_hin_nignore */
+	atomic_t		hin_ignore[0];
+#endif
+};
+
+struct au_hinode ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:23 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
common functions to internal inotify and delegate-mode

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/hin_or_dlgt.c |  705 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 705 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/hin_or_dlgt.c

diff --git a/fs/aufs/hin_or_dlgt.c b/fs/aufs/hin_or_dlgt.c
new file mode 100644
index 0000000..362d66d
--- /dev/null
+++ b/fs/aufs/hin_or_dlgt.c
@@ -0,0 +1,705 @@
+/*
+ * Copyright (C) 2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * sub-routines for vfs in hinotify or dlgt mode
+ */
+
+#include <linux/uaccess.h>
+#include "aufs.h"
+
+#if !defined(CONFIG_AUFS_HINOTIFY) && !defined(CONFIG_AUFS_DLGT)
+#error mis-configuraion or Makefile
+#endif
+
+/* ---------------------------------------------------------------------- */
+
+struct permission_args {
+	int *errp;
+	struct inode *inode;
+	int mask;
+	struct nameidata *nd;
+};
+
+static void call_permission(void *args)
+{
+	struct permission_args *a = args;
+	*a->errp = do_vfsub_permission(a->inode, a->mask, a->nd);
+}
+
+int vfsub_permission(struct inode *inode, int mask, struct nameidata *nd,
+		     int dlgt)
+{
+	if (!dlgt)
+		return ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
dentry operations and private data

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/dentry.h |  381 ++++++++++++++++++++++++++++++++++++++++++++++++++
 fs/aufs/dinfo.c  |  409 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 790 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/dentry.h
 create mode 100644 fs/aufs/dinfo.c

diff --git a/fs/aufs/dentry.h b/fs/aufs/dentry.h
new file mode 100644
index 0000000..87afc1b
--- /dev/null
+++ b/fs/aufs/dentry.h
@@ -0,0 +1,381 @@
+/*
+ * Copyright (C) 2005-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * lookup and dentry operations
+ */
+
+#ifndef __AUFS_DENTRY_H__
+#define __AUFS_DENTRY_H__
+
+#ifdef __KERNEL__
+
+#include <linux/fs.h>
+#include <linux/namei.h>
+#include <linux/aufs_type.h>
+#include "misc.h"
+#include "super.h"
+#include "vfsub.h"
+
+/* nameidata open_intent */
+enum {
+	AuIntent_AUFS,
+	AuIntent_BRANCH,
+	AuIntent_Last
+};
+
+struct au_hdintent {
+	struct list_head	hdi_list;
+	struct file		*hdi_file[AuIntent_Last];
+};
+
+struct au_hdentry {
+	struct dentry		*hd_dentry;
+
+#ifdef CONFIG_AUFS_BR_NFS
+	spinlock_t		hd_lock; /* intest_list */
+	struct ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
main readdir function

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/vdir.c |  928 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 928 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/vdir.c

diff --git a/fs/aufs/vdir.c b/fs/aufs/vdir.c
new file mode 100644
index 0000000..6371160
--- /dev/null
+++ b/fs/aufs/vdir.c
@@ -0,0 +1,928 @@
+/*
+ * Copyright (C) 2005-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * virtual or vertical directory
+ */
+
+#include "aufs.h"
+
+static int calc_size(int namelen)
+{
+	int sz;
+
+	sz = sizeof(struct au_vdir_de) + namelen;
+	if (sizeof(ino_t) == sizeof(long)) {
+		const int mask = sizeof(ino_t) - 1;
+		if (sz & mask) {
+			sz += sizeof(ino_t);
+			sz &= ~mask;
+		}
+	}
+
+	AuDebugOn(sz % sizeof(ino_t));
+	return sz;
+}
+
+static int set_deblk_end(union au_vdir_deblk_p *p,
+			 union au_vdir_deblk_p *deblk_end)
+{
+	if (calc_size(0) <= deblk_end->p - p->p) {
+		p->de->de_str.len = 0;
+		/* smp_mb(); */
+		return 0;
+	}
+	return -1; /* error */
+}
+
+/* returns true or false */
+static int is_deblk_end(union au_vdir_deblk_p *p,
+			union au_vdir_deblk_p *deblk_end)
+{
+	if ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
dentry operations
main lookup operation

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/dentry.c |  959 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 959 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/dentry.c

diff --git a/fs/aufs/dentry.c b/fs/aufs/dentry.c
new file mode 100644
index 0000000..1e16848
--- /dev/null
+++ b/fs/aufs/dentry.c
@@ -0,0 +1,959 @@
+/*
+ * Copyright (C) 2005-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * lookup and dentry operations
+ */
+
+#include "aufs.h"
+
+/* ---------------------------------------------------------------------- */
+
+/*
+ * au_lkup_one() is a generic abstract entry function which calls
+ * lookup_one_len() or __lookup_hash() finally. it is some condisions that makes
+ * lookup complicated, which are nfs branch, open-intent and dlgt mode.
+ */
+
+#if defined(CONFIG_AUFS_BR_NFS) || defined(CONFIG_AUFS_DLGT)
+/* cf. lookup_one_len() in linux/fs/namei.c */
+struct dentry *au_lkup_one(const char *name, struct dentry *parent, int len,
+			   struct au_ndx *ndx)
+{
+	struct dentry *dentry;
+
+	LKTRTrace("%.*s/%.*s, ndx{%d, 0x%x}\n",
+		  AuDLNPair(parent), len, name, !!ndx->nfsmnt, ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
internal copy-up functions
see wbr_policy.c for copy-down

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/cpup.c | 1021 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 fs/aufs/cpup.h |   80 +++++
 2 files changed, 1101 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/cpup.c
 create mode 100644 fs/aufs/cpup.h

diff --git a/fs/aufs/cpup.c b/fs/aufs/cpup.c
new file mode 100644
index 0000000..2fbfe9b
--- /dev/null
+++ b/fs/aufs/cpup.c
@@ -0,0 +1,1021 @@
+/*
+ * Copyright (C) 2005-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * copy-up functions, see wbr_policy.c for copy-down
+ */
+
+#include <linux/fs_stack.h>
+#include <linux/uaccess.h>
+#include "aufs.h"
+
+/* todo? violent cpup_attr_*() functions don't care inode lock */
+void au_cpup_attr_timesizes(struct inode *inode)
+{
+	struct inode *h_inode;
+
+	LKTRTrace("i%lu\n", inode->i_ino);
+	/* todo? IMustLock(inode); */
+	h_inode = au_h_iptr(inode, au_ibstart(inode));
+	AuDebugOn(!h_inode);
+	/* todo? IMustLock(!h_inode); */
+
+	fsstack_copy_attr_times(inode, h_inode);
+	/* todo: this spin_lock conflicts the new unionfs patch in -mm tree */
+	/* spin_lock(&inode->i_lock); ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
file operations and vm operations

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/f_op.c |  645 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 645 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/f_op.c

diff --git a/fs/aufs/f_op.c b/fs/aufs/f_op.c
new file mode 100644
index 0000000..cf48f45
--- /dev/null
+++ b/fs/aufs/f_op.c
@@ -0,0 +1,645 @@
+/*
+ * Copyright (C) 2005-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * file and vm operations
+ */
+
+#include <linux/fs_stack.h>
+#include <linux/poll.h>
+#include "aufs.h"
+
+/* common function to regular file and dir */
+int aufs_flush(struct file *file, fl_owner_t id)
+{
+	int err;
+	struct dentry *dentry;
+	aufs_bindex_t bindex, bend;
+
+	dentry = file->f_dentry;
+	LKTRTrace("%.*s\n", AuDLNPair(dentry));
+
+	si_noflush_read_lock(dentry->d_sb);
+	fi_read_lock(file);
+	di_read_lock_child(dentry, AuLock_IW);
+
+	err = 0;
+	bend = au_fbend(file);
+	for (bindex = au_fbstart(file); !err && bindex <= bend; bindex++) {
+		struct file *h_file;
+		h_file = au_h_fptr(file, bindex);
+		if (h_file && h_file->f_op && h_file->f_op->flush) {
+			err = h_file->f_op->flush(h_file, ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
workqueue for asynchronous, super-io or delegated operations.
they are used in various places such as,
- handling 'opaque' directory and whiteout
- lookup and copy-up/down with credential
- create/remove files and file i/o by delegation
- internal xino file i/o

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/wkq.c |  294 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 fs/aufs/wkq.h |  158 +++++++++++++++++++++++++++++++
 2 files changed, 452 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/wkq.c
 create mode 100644 fs/aufs/wkq.h

diff --git a/fs/aufs/wkq.c b/fs/aufs/wkq.c
new file mode 100644
index 0000000..4c7d1d3
--- /dev/null
+++ b/fs/aufs/wkq.c
@@ -0,0 +1,294 @@
+/*
+ * Copyright (C) 2005-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * workqueue for asynchronous/super-io/delegated operations
+ */
+
+#include <linux/module.h>
+#include "aufs.h"
+
+struct au_wkq *au_wkq;
+
+struct au_cred {
+#ifdef CONFIG_AUFS_DLGT
+	int umask;
+	uid_t fsuid;
+	gid_t fsgid;
+	kernel_cap_t cap_effective, cap_inheritable, cap_permitted;
+#if 0 /* reserved for future use */
+	unsigned keep_capabilities:1;
+	struct user_struct *user;
+	struct fs_struct ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

	initial commit
	aufs manual

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 Documentation/filesystems/aufs/aufs.5 | 1609 +++++++++++++++++++++++++++++++++
 1 files changed, 1609 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/filesystems/aufs/aufs.5

diff --git a/Documentation/filesystems/aufs/aufs.5 b/Documentation/filesystems/aufs/aufs.5
new file mode 100644
index 0000000..42aabc6
--- /dev/null
+++ b/Documentation/filesystems/aufs/aufs.5
@@ -0,0 +1,1609 @@
+.ds AUFS_VERSION 20080521-mm
+.ds AUFS_XINO_FNAME .aufs.xino
+.ds AUFS_XINO_DEFPATH /tmp/.aufs.xino
+.ds AUFS_DIRWH_DEF 3
+.ds AUFS_WH_PFX .wh.
+.ds AUFS_WH_PFX_LEN 4
+.ds AUFS_WKQ_NAME aufsd
+.ds AUFS_NWKQ_DEF 4
+.ds AUFS_WH_DIROPQ .wh..wh..opq
+.ds AUFS_WH_BASENAME .wh.aufs
+.ds AUFS_WH_PLINKDIR .wh.plink
+.ds AUFS_BRANCH_MAX 127
+.ds AUFS_MFS_SECOND_DEF 30
+.\".so aufs.tmac
+.
+.eo
+.de TQ
+.br
+.ns
+.TP \$1
+..
+.de Bu
+.IP \(bu 4
+..
+.ec
+.\" end of macro definitions
+.
+.\" ----------------------------------------------------------------------
+.TH aufs 5 \*[AUFS_VERSION] Linux "Linux Aufs User\[aq]s Manual"
+.SH NAME
+aufs \- another unionfs. version \*[AUFS_VERSION]
+
+.\" ----------------------------------------------------------------------
+.SH DESCRIPTION
+Aufs is a stackable unification filesystem such as Unionfs, which unifies
+several directories and provides a merged single directory.
+In the early days, aufs was entirely re-designed and re-implemented
+Unionfs Version 1.x series. After
+many original ideas, approaches and improvements, it
+becomes totally different from Unionfs while keeping the basic features.
+See Unionfs Version 1.x series for the basic features.
+Recently, Unionfs Version 2.x series begin taking some of same
+approaches to aufs\[aq]s.
+
+.\" ----------------------------------------------------------------------
+.SH MOUNT OPTIONS
+At mount-time, the order of interpreting options ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
main header file
module initialization and module global vars

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/aufs.h   |   52 ++++++++++++++++++
 fs/aufs/module.c |  153 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 fs/aufs/module.h |   72 +++++++++++++++++++++++++
 3 files changed, 277 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/aufs.h
 create mode 100644 fs/aufs/module.c
 create mode 100644 fs/aufs/module.h

diff --git a/fs/aufs/aufs.h b/fs/aufs/aufs.h
new file mode 100644
index 0000000..fbca615
--- /dev/null
+++ b/fs/aufs/aufs.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2005-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * main header files
+ */
+
+#ifndef __AUFS_H__
+#define __AUFS_H__
+
+#ifdef __KERNEL__
+
+#include <linux/version.h>
+
+#include "debug.h"
+
+#include "branch.h"
+#include "cpup.h"
+#include "dcsub.h"
+#include "dentry.h"
+#include "dir.h"
+#include "file.h"
+#include "hinode.h"
+#include "inode.h"
+#include "misc.h"
+#include "module.h"
+#include "opts.h"
+#include "super.h"
+#include "sysaufs.h"
+#include "vfsub.h"
+#include "whout.h"
+#include "wkq.h"
+/* reserved for future use */
+/* #include "xattr.h" ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

	initial commit
	aufs configuration and Makefile

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/Kconfig  |  174 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 fs/aufs/Makefile |   39 ++++++++++++
 2 files changed, 213 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/Kconfig
 create mode 100644 fs/aufs/Makefile

diff --git a/fs/aufs/Kconfig b/fs/aufs/Kconfig
new file mode 100644
index 0000000..338c01c
--- /dev/null
+++ b/fs/aufs/Kconfig
@@ -0,0 +1,174 @@
+config AUFS
+	bool "Another unionfs (EXPERIMENTAL)"
+	depends on EXPERIMENTAL
+	help
+	Aufs is a stackable unification filesystem such as Unionfs,
+	which unifies several directories and provides a merged single
+	directory.
+	In the early days, aufs was entirely re-designed and
+	re-implemented Unionfs Version 1.x series. After many original
+	ideas, approaches and improvements, it becomes totally
+	different from Unionfs while keeping the basic features.
+	See Unionfs for the basic features.
+
+if AUFS
+choice
+	prompt "Maximum number of branches"
+	default AUFS_BRANCH_MAX_127
+	help
+	Specifies the maximum number of branches (or member directories)
+	in a single aufs. The larger value consumes more system
+	resources and has an impact to performance.
+config AUFS_BRANCH_MAX_127
+	bool "127"
+	help
+	Specifies the maximum number of branches (or member directories)
+	in a single aufs. The larger value consumes more system
+	resources and has an impact to performance.
+config AUFS_BRANCH_MAX_511
+	bool "511"
+	help
+	Specifies the maximum number of branches (or member directories)
+	in a single aufs. The larger value consumes more system
+	resources and has an impact to performance.
+config AUFS_BRANCH_MAX_1023
+	bool "1023"
+	help
+	Specifies the maximum number of branches (or member directories)
+	in a single aufs. The larger value consumes more system
+	resources and has an impact to performance.
+# config ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

branch management

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/branch.c |  912 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 fs/aufs/branch.h |  352 +++++++++++++++++++++
 2 files changed, 1264 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/branch.c
 create mode 100644 fs/aufs/branch.h

diff --git a/fs/aufs/branch.c b/fs/aufs/branch.c
new file mode 100644
index 0000000..88b6258
--- /dev/null
+++ b/fs/aufs/branch.c
@@ -0,0 +1,912 @@
+/*
+ * Copyright (C) 2005-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * branch management
+ */
+
+#include <linux/iso_fs.h>
+#include <linux/loop.h>
+#include <linux/romfs_fs.h>
+#include <linux/smp_lock.h>
+#include "aufs.h"
+
+static void free_branch(struct au_branch *br)
+{
+	AuTraceEnter();
+
+	if (br->br_xino)
+		fput(br->br_xino);
+	dput(br->br_wh);
+	dput(br->br_plink);
+	if (!au_test_nfs(br->br_mnt->mnt_sb))
+		mntput(br->br_mnt);
+	else {
+		lockdep_off();
+		mntput(br->br_mnt);
+		lockdep_on();
+	}
+	AuDebugOn(au_br_count(br) || atomic_read(&br->br_wh_running));
+	kfree(br);
+}
+
+/*
+ * frees all branches
+ */
+void au_br_free(struct au_sbinfo *sbinfo)
+{
+	aufs_bindex_t bmax;
+	struct au_branch ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
br_fuse.c	special handling for inode attributes on FUSE branch
br_nfs.c	lookup functions for NFS branch
br_xfs.c	special handling inode attributes on XFS branch

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/br_fuse.c |  107 ++++++++++++++++
 fs/aufs/br_nfs.c  |  347 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 fs/aufs/br_xfs.c  |   67 ++++++++++
 3 files changed, 521 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/br_fuse.c
 create mode 100644 fs/aufs/br_nfs.c
 create mode 100644 fs/aufs/br_xfs.c

diff --git a/fs/aufs/br_fuse.c b/fs/aufs/br_fuse.c
new file mode 100644
index 0000000..1c0182b
--- /dev/null
+++ b/fs/aufs/br_fuse.c
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * special handling for inode attributes on FUSE branch
+ */
+
+#include "aufs.h"
+
+/* h_mnt can be NULL, is it safe? */
+int au_update_fuse_h_inode(struct vfsmount *h_mnt, struct dentry *h_dentry)
+{
+	int err;
+	struct kstat st;
+
+	LKTRTrace("%.*s\n", AuDLNPair(h_dentry));
+
+	err = 0;
+	if (unlikely(h_dentry->d_inode
+		     /* && atomic_read(&h_dentry->d_inode->i_count) */
+		     && au_test_fuse(h_dentry->d_sb))) {
+		err = ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
some aufs objects have a corresponding entry under sysfs, so the
lifetime will be managed by struct kref even if CONFIG_SYSFS is
disabled.
This file is compiled unconditionally.

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/sysaufs.c |  102 +++++++++++++++++++++++++++++++++++++++
 fs/aufs/sysaufs.h |  137 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 239 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/sysaufs.c
 create mode 100644 fs/aufs/sysaufs.h

diff --git a/fs/aufs/sysaufs.c b/fs/aufs/sysaufs.c
new file mode 100644
index 0000000..0872b7a
--- /dev/null
+++ b/fs/aufs/sysaufs.c
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2007-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * sysfs interface and lifetime management
+ * they are necessary regardless sysfs is disabled.
+ */
+
+#include <linux/fs.h>
+#include <linux/module.h>
+#include <linux/sysfs.h>
+#include "aufs.h"
+
+/* ---------------------------------------------------------------------- */
+
+/* super_blocks list is not exported */
+DEFINE_MUTEX(au_sbilist_mtx);
+LIST_HEAD(au_sbilist);
+
+/* ---------------------------------------------------------------------- ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
sub-routines or simple wrappers for VFS

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/vfsub.c |  633 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 fs/aufs/vfsub.h |  472 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 1105 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/vfsub.c
 create mode 100644 fs/aufs/vfsub.h

diff --git a/fs/aufs/vfsub.c b/fs/aufs/vfsub.c
new file mode 100644
index 0000000..bc3ce64
--- /dev/null
+++ b/fs/aufs/vfsub.c
@@ -0,0 +1,633 @@
+/*
+ * Copyright (C) 2007-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * sub-routines for VFS
+ */
+
+#include <linux/uaccess.h>
+#include "aufs.h"
+
+/* ---------------------------------------------------------------------- */
+
+void vfsub_args_init(struct vfsub_args *vargs, struct au_hin_ignore *ign,
+		     int dlgt, int force_unlink)
+{
+	do_vfsub_args_reinit(vargs, ign);
+	vargs->flags = 0;
+	if (unlikely(dlgt))
+		vfsub_fset(vargs->flags, DLGT);
+	if (force_unlink)
+		vfsub_fset(vargs->flags, FORCE_UNLINK);
+}
+
+/* ---------------------------------------------------------------------- */
+
+struct file *vfsub_filp_open(const char *path, int oflags, int ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
sub-routines or simple wrappers for dentry cache

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/dcsub.c |  244 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 fs/aufs/dcsub.h |   52 ++++++++++++
 2 files changed, 296 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/dcsub.c
 create mode 100644 fs/aufs/dcsub.h

diff --git a/fs/aufs/dcsub.c b/fs/aufs/dcsub.c
new file mode 100644
index 0000000..cd8e0b1
--- /dev/null
+++ b/fs/aufs/dcsub.c
@@ -0,0 +1,244 @@
+/*
+ * Copyright (C) 2007-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * sub-routines for dentry cache
+ */
+
+#include "aufs.h"
+
+static void au_dpage_free(struct au_dpage *dpage)
+{
+	int i;
+
+	AuTraceEnter();
+	AuDebugOn(!dpage);
+
+	for (i = 0; i < dpage->ndentry; i++)
+		dput(dpage->dentries[i]);
+	free_page((unsigned long)dpage->dentries);
+}
+
+int au_dpages_init(struct au_dcsub_pages *dpages, gfp_t gfp)
+{
+	int err;
+	void *p;
+
+	AuTraceEnter();
+
+	err = -ENOMEM;
+	dpages->dpages = kmalloc(sizeof(*dpages->dpages), gfp);
+	if (unlikely(!dpages->dpages))
+		goto out;
+	p = (void *)__get_free_page(gfp);
+	if (unlikely(!p))
+		goto out_dpages;
+	dpages->dpages[0].ndentry = ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
when creating/removing an entry and there are multiple writable branches
specified in aufs, aufs has to decide which branch is the target.
aufs has several policies for that such as, round-robin, most-free-space
and so on.

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/wbr_policy.c |  685 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 685 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/wbr_policy.c

diff --git a/fs/aufs/wbr_policy.c b/fs/aufs/wbr_policy.c
new file mode 100644
index 0000000..6099325
--- /dev/null
+++ b/fs/aufs/wbr_policy.c
@@ -0,0 +1,685 @@
+/*
+ * Copyright (C) 2007-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * policies for selecting one among multiple writable branches
+ */
+
+#include <linux/statfs.h>
+#include "aufs.h"
+
+static int au_cpdown_attr(struct dentry *h_dst, struct dentry *h_src, int dlgt)
+{
+	int err, sbits;
+	struct iattr ia;
+	struct inode *h_idst, *h_isrc;
+	struct vfsub_args vargs;
+
+	LKTRTrace("%.*s\n", AuDLNPair(h_dst));
+	h_idst = h_dst->d_inode;
+	/* todo? IMustLock(h_idst); */
+	h_isrc = h_src->d_inode;
+	/* todo? IMustLock(h_isrc); */
+
+	ia.ia_valid = ATTR_FORCE | ATTR_MODE | ...
From: hooanon05
Date: Tuesday, May 20, 2008 - 8:22 pm

From: Junjiro Okajima <hooanon05@yahoo.co.jp>

initial commit
inode rename operation

Signed-off-by: Junjiro Okajima <hooanon05@yahoo.co.jp>
---
 fs/aufs/i_op_ren.c |  788 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 788 insertions(+), 0 deletions(-)
 create mode 100644 fs/aufs/i_op_ren.c

diff --git a/fs/aufs/i_op_ren.c b/fs/aufs/i_op_ren.c
new file mode 100644
index 0000000..b61d4cb
--- /dev/null
+++ b/fs/aufs/i_op_ren.c
@@ -0,0 +1,788 @@
+/*
+ * Copyright (C) 2005-2008 Junjiro Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/*
+ * inode operation (rename entry)
+ * todo: this is monster
+ */
+
+#include "aufs.h"
+
+enum { SRC, DST };
+
+#define AuRen_ISDIR	1
+#define AuRen_ISSAMEDIR	(1 << 1)
+#define AuRen_WHSRC	(1 << 2)
+#define AuRen_WHDST	(1 << 3)
+#define AuRen_DLGT	(1 << 4)
+#define au_ftest_ren(flags, name)	((flags) & AuRen_##name)
+#define au_fset_ren(flags, name)	{ (flags) |= AuRen_##name; }
+#define au_fclr_ren(flags, name)	{ (flags) &= ~AuRen_##name; }
+#ifndef CONFIG_AUFS_DLGT
+#undef AuRen_DLGT
+#define AuRen_DLGT	0
+#endif
+
+struct rename_args {
+	struct dentry *h_dentry[2], *parent[2], *h_parent[2], *h_trap;
+	struct au_nhash whlist;
+	aufs_bindex_t btgt, bstart[2];
+	struct super_block *sb;
+	unsigned int ...
Previous thread: Re: [PATCH] ata: fix sleep-while-holding-spinlock in sata_nv by Robert Hancock on Tuesday, May 20, 2008 - 7:17 pm. (4 messages)

Next thread: pull request: wireless-2.6 2008-05-20 by John W. Linville on Tuesday, May 20, 2008 - 7:57 pm. (2 messages)