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

aufs: dirren 6/6, mount options



Introduce the new mount options, dirren and nodirren, which activates
and deactivates DIRREN feature.
In remount and unmount, the inum-list per branch should be flushed to
the file.
Signed-off-by: default avatarJ. R. Okajima <hooanon05g@gmail.com>
parent 866fd027
...@@ -1243,3 +1243,61 @@ int au_dr_lkup_h_ino(struct au_do_lookup_args *lkup, aufs_bindex_t bindex, ...@@ -1243,3 +1243,61 @@ int au_dr_lkup_h_ino(struct au_do_lookup_args *lkup, aufs_bindex_t bindex,
out: out:
return match; return match;
} }
/* ---------------------------------------------------------------------- */
int au_dr_opt_set(struct super_block *sb)
{
int err;
aufs_bindex_t bindex, bbot;
struct au_branch *br;
err = 0;
bbot = au_sbbot(sb);
for (bindex = 0; !err && bindex <= bbot; bindex++) {
br = au_sbr(sb, bindex);
err = au_dr_hino(sb, bindex, /*br*/NULL, &br->br_path);
}
return err;
}
int au_dr_opt_flush(struct super_block *sb)
{
int err;
aufs_bindex_t bindex, bbot;
struct au_branch *br;
err = 0;
bbot = au_sbbot(sb);
for (bindex = 0; !err && bindex <= bbot; bindex++) {
br = au_sbr(sb, bindex);
if (au_br_writable(br->br_perm))
err = au_dr_hino(sb, bindex, /*br*/NULL, /*path*/NULL);
}
return err;
}
int au_dr_opt_clr(struct super_block *sb, int no_flush)
{
int err;
aufs_bindex_t bindex, bbot;
struct au_branch *br;
err = 0;
if (!no_flush) {
err = au_dr_opt_flush(sb);
if (unlikely(err))
goto out;
}
bbot = au_sbbot(sb);
for (bindex = 0; bindex <= bbot; bindex++) {
br = au_sbr(sb, bindex);
au_dr_hino_free(&br->br_dirren);
}
out:
return err;
}
...@@ -86,6 +86,9 @@ int au_dr_lkup_name(struct au_do_lookup_args *lkup, aufs_bindex_t btgt); ...@@ -86,6 +86,9 @@ int au_dr_lkup_name(struct au_do_lookup_args *lkup, aufs_bindex_t btgt);
int au_dr_lkup_h_ino(struct au_do_lookup_args *lkup, aufs_bindex_t bindex, int au_dr_lkup_h_ino(struct au_do_lookup_args *lkup, aufs_bindex_t bindex,
ino_t h_ino); ino_t h_ino);
void au_dr_lkup_fin(struct au_do_lookup_args *lkup); void au_dr_lkup_fin(struct au_do_lookup_args *lkup);
int au_dr_opt_set(struct super_block *sb);
int au_dr_opt_flush(struct super_block *sb);
int au_dr_opt_clr(struct super_block *sb, int no_flush);
#else #else
AuStubInt0(au_dr_hino_test_add, struct au_dr_br *dr, ino_t h_ino, AuStubInt0(au_dr_hino_test_add, struct au_dr_br *dr, ino_t h_ino,
struct au_dr_hino *add_ent); struct au_dr_hino *add_ent);
...@@ -104,6 +107,9 @@ AuStubInt0(au_dr_lkup_name, struct au_do_lookup_args *lkup, aufs_bindex_t btgt); ...@@ -104,6 +107,9 @@ AuStubInt0(au_dr_lkup_name, struct au_do_lookup_args *lkup, aufs_bindex_t btgt);
AuStubInt0(au_dr_lkup_h_ino, struct au_do_lookup_args *lkup, AuStubInt0(au_dr_lkup_h_ino, struct au_do_lookup_args *lkup,
aufs_bindex_t bindex, ino_t h_ino); aufs_bindex_t bindex, ino_t h_ino);
AuStubVoid(au_dr_lkup_fin, struct au_do_lookup_args *lkup); AuStubVoid(au_dr_lkup_fin, struct au_do_lookup_args *lkup);
AuStubInt0(au_dr_opt_set, struct super_block *sb);
AuStubInt0(au_dr_opt_flush, struct super_block *sb);
AuStubInt0(au_dr_opt_clr, struct super_block *sb, int no_flush);
#endif #endif
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
......
...@@ -31,6 +31,7 @@ enum { ...@@ -31,6 +31,7 @@ enum {
Opt_verbose, Opt_noverbose, Opt_verbose, Opt_noverbose,
Opt_sum, Opt_nosum, Opt_wsum, Opt_sum, Opt_nosum, Opt_wsum,
Opt_dirperm1, Opt_nodirperm1, Opt_dirperm1, Opt_nodirperm1,
Opt_dirren, Opt_nodirren,
Opt_acl, Opt_noacl, Opt_acl, Opt_noacl,
Opt_tail, Opt_ignore, Opt_ignore_silent, Opt_err Opt_tail, Opt_ignore, Opt_ignore_silent, Opt_err
}; };
...@@ -85,6 +86,14 @@ static match_table_t options = { ...@@ -85,6 +86,14 @@ static match_table_t options = {
{Opt_dio, "dio"}, {Opt_dio, "dio"},
{Opt_nodio, "nodio"}, {Opt_nodio, "nodio"},
#ifdef CONFIG_AUFS_DIRREN
{Opt_dirren, "dirren"},
{Opt_nodirren, "nodirren"},
#else
{Opt_ignore, "dirren"},
{Opt_ignore_silent, "nodirren"},
#endif
{Opt_dirperm1, "dirperm1"}, {Opt_dirperm1, "dirperm1"},
{Opt_nodirperm1, "nodirperm1"}, {Opt_nodirperm1, "nodirperm1"},
...@@ -634,6 +643,12 @@ static void dump_opts(struct au_opts *opts) ...@@ -634,6 +643,12 @@ static void dump_opts(struct au_opts *opts)
AuDbg("copyup %d, %s\n", opt->wbr_copyup, AuDbg("copyup %d, %s\n", opt->wbr_copyup,
au_optstr_wbr_copyup(opt->wbr_copyup)); au_optstr_wbr_copyup(opt->wbr_copyup));
break; break;
case Opt_dirren:
AuLabel(dirren);
break;
case Opt_nodirren:
AuLabel(nodirren);
break;
case Opt_acl: case Opt_acl:
AuLabel(acl); AuLabel(acl);
break; break;
...@@ -1078,6 +1093,8 @@ int au_opts_parse(struct super_block *sb, char *str, struct au_opts *opts) ...@@ -1078,6 +1093,8 @@ int au_opts_parse(struct super_block *sb, char *str, struct au_opts *opts)
case Opt_wsum: case Opt_wsum:
case Opt_rdblk_def: case Opt_rdblk_def:
case Opt_rdhash_def: case Opt_rdhash_def:
case Opt_dirren:
case Opt_nodirren:
case Opt_acl: case Opt_acl:
case Opt_noacl: case Opt_noacl:
err = 0; err = 0;
...@@ -1306,6 +1323,28 @@ static int au_opt_simple(struct super_block *sb, struct au_opt *opt, ...@@ -1306,6 +1323,28 @@ static int au_opt_simple(struct super_block *sb, struct au_opt *opt,
au_fclr_opts(opts->flags, TRUNC_XIB); au_fclr_opts(opts->flags, TRUNC_XIB);
break; break;
case Opt_dirren:
err = 1;
if (!au_opt_test(sbinfo->si_mntflags, DIRREN)) {
err = au_dr_opt_set(sb);
if (!err)
err = 1;
}
if (err == 1)
au_opt_set(sbinfo->si_mntflags, DIRREN);
break;
case Opt_nodirren:
err = 1;
if (au_opt_test(sbinfo->si_mntflags, DIRREN)) {
err = au_dr_opt_clr(sb, au_ftest_opts(opts->flags,
DR_FLUSHED));
if (!err)
err = 1;
}
if (err == 1)
au_opt_clr(sbinfo->si_mntflags, DIRREN);
break;
case Opt_acl: case Opt_acl:
sb->s_flags |= SB_POSIXACL; sb->s_flags |= SB_POSIXACL;
break; break;
...@@ -1625,7 +1664,11 @@ int au_opts_remount(struct super_block *sb, struct au_opts *opts) ...@@ -1625,7 +1664,11 @@ int au_opts_remount(struct super_block *sb, struct au_opts *opts)
SiMustWriteLock(sb); SiMustWriteLock(sb);
err = 0; err = au_dr_opt_flush(sb);
if (unlikely(err))
goto out;
au_fset_opts(opts->flags, DR_FLUSHED);
dir = d_inode(sb->s_root); dir = d_inode(sb->s_root);
sbinfo = au_sbi(sb); sbinfo = au_sbi(sb);
opt_xino = NULL; opt_xino = NULL;
...@@ -1667,6 +1710,7 @@ int au_opts_remount(struct super_block *sb, struct au_opts *opts) ...@@ -1667,6 +1710,7 @@ int au_opts_remount(struct super_block *sb, struct au_opts *opts)
AuDbg("status 0x%x\n", opts->flags); AuDbg("status 0x%x\n", opts->flags);
out:
return err; return err;
} }
......
...@@ -162,12 +162,18 @@ struct au_opt { ...@@ -162,12 +162,18 @@ struct au_opt {
#define AuOpts_TRUNC_XIB (1 << 2) #define AuOpts_TRUNC_XIB (1 << 2)
#define AuOpts_REFRESH_DYAOP (1 << 3) #define AuOpts_REFRESH_DYAOP (1 << 3)
#define AuOpts_REFRESH_IDOP (1 << 4) #define AuOpts_REFRESH_IDOP (1 << 4)
#define AuOpts_DR_FLUSHED (1 << 5)
#define au_ftest_opts(flags, name) ((flags) & AuOpts_##name) #define au_ftest_opts(flags, name) ((flags) & AuOpts_##name)
#define au_fset_opts(flags, name) \ #define au_fset_opts(flags, name) \
do { (flags) |= AuOpts_##name; } while (0) do { (flags) |= AuOpts_##name; } while (0)
#define au_fclr_opts(flags, name) \ #define au_fclr_opts(flags, name) \
do { (flags) &= ~AuOpts_##name; } while (0) do { (flags) &= ~AuOpts_##name; } while (0)
#ifndef CONFIG_AUFS_DIRREN
#undef AuOpts_DR_FLUSHED
#define AuOpts_DR_FLUSHED 0
#endif
struct au_opts { struct au_opts {
struct au_opt *opt; struct au_opt *opt;
int max_opt; int max_opt;
......
...@@ -276,6 +276,7 @@ static int aufs_show_options(struct seq_file *m, struct dentry *dentry) ...@@ -276,6 +276,7 @@ static int aufs_show_options(struct seq_file *m, struct dentry *dentry)
AuUInt(RDBLK, rdblk, sbinfo->si_rdblk); AuUInt(RDBLK, rdblk, sbinfo->si_rdblk);
AuUInt(RDHASH, rdhash, sbinfo->si_rdhash); AuUInt(RDHASH, rdhash, sbinfo->si_rdhash);
AuBool(DIRREN, dirren);
AuBool(SUM, sum); AuBool(SUM, sum);
/* AuBool(SUM_W, wsum); */ /* AuBool(SUM_W, wsum); */
AuBool(VERBOSE, verbose); AuBool(VERBOSE, verbose);
...@@ -1006,6 +1007,7 @@ static void aufs_kill_sb(struct super_block *sb) ...@@ -1006,6 +1007,7 @@ static void aufs_kill_sb(struct super_block *sb)
if (au_opt_test(sbinfo->si_mntflags, PLINK)) if (au_opt_test(sbinfo->si_mntflags, PLINK))
au_plink_put(sb, /*verbose*/1); au_plink_put(sb, /*verbose*/1);
au_xino_clr(sb); au_xino_clr(sb);
au_dr_opt_flush(sb);
sbinfo->si_sb = NULL; sbinfo->si_sb = NULL;
aufs_write_unlock(sb->s_root); aufs_write_unlock(sb->s_root);
au_nwt_flush(&sbinfo->si_nowait); au_nwt_flush(&sbinfo->si_nowait);
......
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