Created
April 8, 2012 01:49
-
-
Save sowawa/2333569 to your computer and use it in GitHub Desktop.
git diff kernel 2.6.36 at fe4d2ca
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/fs/aufs/branch.c b/fs/aufs/branch.c | |
index 55a8fab..4687a35 100644 | |
--- a/fs/aufs/branch.c | |
+++ b/fs/aufs/branch.c | |
@@ -851,13 +851,12 @@ static unsigned long long au_farray_cb(void *a, | |
{ | |
unsigned long long n; | |
struct file **p, *f; | |
- struct list_head *head; | |
+ struct super_block *sb = arg; | |
n = 0; | |
p = a; | |
- head = arg; | |
- file_list_lock(); | |
- list_for_each_entry(f, head, f_u.fu_list) | |
+ lg_global_lock(files_lglock); | |
+ do_file_list_for_each_entry(sb, f) { | |
if (au_fi(f) | |
&& !special_file(f->f_dentry->d_inode->i_mode)) { | |
get_file(f); | |
@@ -865,7 +864,8 @@ static unsigned long long au_farray_cb(void *a, | |
n++; | |
AuDebugOn(n > max); | |
} | |
- file_list_unlock(); | |
+ } while_file_list_for_each_entry; | |
+ lg_global_unlock(files_lglock); | |
return n; | |
} | |
@@ -874,7 +874,7 @@ static struct file **au_farray_alloc(struct super_block *sb, | |
unsigned long long *max) | |
{ | |
*max = atomic_long_read(&au_sbi(sb)->si_nfiles); | |
- return au_array_alloc(max, au_farray_cb, &sb->s_files); | |
+ return au_array_alloc(max, au_farray_cb, sb); | |
} | |
static void au_farray_free(struct file **a, unsigned long long max) | |
diff --git a/fs/aufs/dir.c b/fs/aufs/dir.c | |
index 0001998..84c6c4e 100644 | |
--- a/fs/aufs/dir.c | |
+++ b/fs/aufs/dir.c | |
@@ -213,7 +213,7 @@ static int aufs_release_dir(struct inode *inode __maybe_unused, | |
fidir = finfo->fi_hdir; | |
if (fidir) { | |
/* remove me from sb->s_files */ | |
- file_kill(file); | |
+ file_sb_list_del(file); | |
vdir_cache = fidir->fd_vdir_cache; /* lock-free */ | |
if (vdir_cache) | |
diff --git a/fs/aufs/f_op.c b/fs/aufs/f_op.c | |
index 510df06..67fe074 100644 | |
--- a/fs/aufs/f_op.c | |
+++ b/fs/aufs/f_op.c | |
@@ -82,7 +82,7 @@ int aufs_release_nondir(struct inode *inode __maybe_unused, struct file *file) | |
bindex = finfo->fi_btop; | |
if (bindex >= 0) { | |
/* remove me from sb->s_files */ | |
- file_kill(file); | |
+ file_sb_list_del(file); | |
au_set_h_fptr(file, bindex, NULL); | |
} | |
diff --git a/fs/aufs/sysrq.c b/fs/aufs/sysrq.c | |
index fad3a5b..658d5ac 100644 | |
--- a/fs/aufs/sysrq.c | |
+++ b/fs/aufs/sysrq.c | |
@@ -56,14 +56,14 @@ static void sysrq_sb(struct super_block *sb) | |
spin_unlock(&inode_lock); | |
#endif | |
printk(KERN_WARNING AUFS_NAME ": files\n"); | |
- file_list_lock(); | |
- list_for_each_entry(file, &sb->s_files, f_u.fu_list) { | |
+ lg_global_lock(files_lglock); | |
+ do_file_list_for_each_entry(sb, file) { | |
umode_t mode; | |
mode = file->f_dentry->d_inode->i_mode; | |
if (!special_file(mode) || au_special_file(mode)) | |
au_dpri_file(file); | |
- } | |
- file_list_unlock(); | |
+ } while_file_list_for_each_entry; | |
+ lg_global_unlock(files_lglock); | |
printk(KERN_WARNING AUFS_NAME ": done\n"); | |
au_plevel = plevel; | |
diff --git a/fs/aufs/vfsub.h b/fs/aufs/vfsub.h | |
index 05c43c6..3247f17 100644 | |
--- a/fs/aufs/vfsub.h | |
+++ b/fs/aufs/vfsub.h | |
@@ -26,11 +26,46 @@ | |
#ifdef __KERNEL__ | |
#include <linux/fs.h> | |
+#include <linux/lglock.h> | |
#include "debug.h" | |
/* fs/internal.h */ | |
extern spinlock_t vfsmount_lock; | |
+/* copied from linux/fs/internal.h */ | |
+extern void file_sb_list_del(struct file *f); | |
+ | |
+/* copied from linux/fs/file_table.c */ | |
+DECLARE_LGLOCK(files_lglock); | |
+#ifdef CONFIG_SMP | |
+/* | |
+ * These macros iterate all files on all CPUs for a given superblock. | |
+ * files_lglock must be held globally. | |
+ */ | |
+#define do_file_list_for_each_entry(__sb, __file) \ | |
+{ \ | |
+ int i; \ | |
+ for_each_possible_cpu(i) { \ | |
+ struct list_head *list; \ | |
+ list = per_cpu_ptr((__sb)->s_files, i); \ | |
+ list_for_each_entry((__file), list, f_u.fu_list) | |
+ | |
+#define while_file_list_for_each_entry \ | |
+ } \ | |
+} | |
+ | |
+#else | |
+ | |
+#define do_file_list_for_each_entry(__sb, __file) \ | |
+{ \ | |
+ struct list_head *list; \ | |
+ list = &(sb)->s_files; \ | |
+ list_for_each_entry((__file), list, f_u.fu_list) | |
+ | |
+#define while_file_list_for_each_entry \ | |
+} | |
+#endif | |
+ | |
/* ---------------------------------------------------------------------- */ | |
/* lock subclass for lower inode */ | |
@@ -52,13 +87,14 @@ enum { | |
/* ---------------------------------------------------------------------- */ | |
- | |
static inline void vfsub_drop_nlink(struct inode *inode) | |
{ | |
AuDebugOn(!inode->i_nlink); | |
drop_nlink(inode); | |
} | |
+/* ---------------------------------------------------------------------- */ | |
+ | |
int vfsub_update_h_iattr(struct path *h_path, int *did); | |
struct file *vfsub_dentry_open(struct path *path, int flags); | |
struct file *vfsub_filp_open(const char *path, int oflags, int mode); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment