Commit a35f55f4 authored by J. R. Okajima's avatar J. R. Okajima
Browse files

aufs: sbinfo list



When user accesses aufs via other than fs related systemcalls, aufs
needs to identify which superblock is the target.  Here is the trick.
It is just a list of aufs superblocks.  Such way will be procfs and
MagicSysRq key.  For MagicSysRq support, see the later commit.
This is a dirty approach which I don't like, but I just don't have
another idea.
Signed-off-by: default avatarJ. R. Okajima <hooanon05g@gmail.com>
parent 6be3b122
...@@ -44,6 +44,14 @@ config AUFS_BRANCH_MAX_32767 ...@@ -44,6 +44,14 @@ config AUFS_BRANCH_MAX_32767
resources and has a minor impact to performance. resources and has a minor impact to performance.
endchoice endchoice
config AUFS_SBILIST
bool
depends on PROC_FS
default y
help
Automatic configuration for internal use.
When aufs supports Magic SysRq or /proc, enabled automatically.
config AUFS_DEBUG config AUFS_DEBUG
bool "Debug aufs" bool "Debug aufs"
help help
......
...@@ -103,6 +103,14 @@ static int __init au_cache_init(void) ...@@ -103,6 +103,14 @@ static int __init au_cache_init(void)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
#ifdef CONFIG_AUFS_SBILIST
/*
* iterate_supers_type() doesn't protect us from
* remounting (branch management)
*/
struct hlist_bl_head au_sbilist;
#endif
/* /*
* functions for module interface. * functions for module interface.
*/ */
...@@ -151,6 +159,7 @@ static int __init aufs_init(void) ...@@ -151,6 +159,7 @@ static int __init aufs_init(void)
memset(au_cache, 0, sizeof(au_cache)); memset(au_cache, 0, sizeof(au_cache));
au_sbilist_init();
sysaufs_brs_init(); sysaufs_brs_init();
err = sysaufs_init(); err = sysaufs_init();
if (unlikely(err)) if (unlikely(err))
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/kobject.h> #include <linux/kobject.h>
#include "hbl.h"
#include "rwsem.h" #include "rwsem.h"
#include "wkq.h" #include "wkq.h"
...@@ -66,6 +67,10 @@ struct au_sbinfo { ...@@ -66,6 +67,10 @@ struct au_sbinfo {
*/ */
struct kobject si_kobj; struct kobject si_kobj;
#ifdef CONFIG_AUFS_SBILIST
struct hlist_bl_node si_list;
#endif
/* dirty, necessary for unmounting, sysfs and sysrq */ /* dirty, necessary for unmounting, sysfs and sysrq */
struct super_block *si_sb; struct super_block *si_sb;
}; };
...@@ -108,6 +113,35 @@ static inline struct au_sbinfo *au_sbi(struct super_block *sb) ...@@ -108,6 +113,35 @@ static inline struct au_sbinfo *au_sbi(struct super_block *sb)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
#ifdef CONFIG_AUFS_SBILIST
/* module.c */
extern struct hlist_bl_head au_sbilist;
static inline void au_sbilist_init(void)
{
INIT_HLIST_BL_HEAD(&au_sbilist);
}
static inline void au_sbilist_add(struct super_block *sb)
{
au_hbl_add(&au_sbi(sb)->si_list, &au_sbilist);
}
static inline void au_sbilist_del(struct super_block *sb)
{
au_hbl_del(&au_sbi(sb)->si_list, &au_sbilist);
}
#define AuGFP_SBILIST GFP_NOFS
#else
AuStubVoid(au_sbilist_init, void)
AuStubVoid(au_sbilist_add, struct super_block *sb)
AuStubVoid(au_sbilist_del, struct super_block *sb)
#define AuGFP_SBILIST GFP_NOFS
#endif
/* ---------------------------------------------------------------------- */
/* lock superblock. mainly for entry point functions */ /* lock superblock. mainly for entry point functions */
#define __si_read_lock(sb) au_rw_read_lock(&au_sbi(sb)->si_rwsem) #define __si_read_lock(sb) au_rw_read_lock(&au_sbi(sb)->si_rwsem)
#define __si_write_lock(sb) au_rw_write_lock(&au_sbi(sb)->si_rwsem) #define __si_write_lock(sb) au_rw_write_lock(&au_sbi(sb)->si_rwsem)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment