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

aufs: diropq_[aw] options



These are very old options.
Since Unionfs created 'diropq' unconditionally in mkdir(2), old users
may expect the same behaviour. But there are cases where 'diropq' is
unnecessary. The aufs default behaviour is to create 'diropq' only when
it is necessary.
Signed-off-by: default avatarJ. R. Okajima <hooanon05g@gmail.com>
parent 9723961f
...@@ -858,7 +858,8 @@ int aufs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) ...@@ -858,7 +858,8 @@ int aufs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
/* make the dir opaque */ /* make the dir opaque */
diropq = 0; diropq = 0;
h_inode = d_inode(h_path.dentry); h_inode = d_inode(h_path.dentry);
if (wh_dentry) { if (wh_dentry
|| au_opt_test(au_mntflags(sb), ALWAYS_DIROPQ)) {
inode_lock_nested(h_inode, AuLsc_I_CHILD); inode_lock_nested(h_inode, AuLsc_I_CHILD);
opq_dentry = au_diropq_create(dentry, bindex); opq_dentry = au_diropq_create(dentry, bindex);
inode_unlock(h_inode); inode_unlock(h_inode);
......
...@@ -297,10 +297,12 @@ static int au_ren_do_diropq(struct au_ren_args *a, int idx) ...@@ -297,10 +297,12 @@ static int au_ren_do_diropq(struct au_ren_args *a, int idx)
static int au_ren_diropq(struct au_ren_args *a) static int au_ren_diropq(struct au_ren_args *a)
{ {
int err; int err;
unsigned char always;
struct dentry *d; struct dentry *d;
err = 0; err = 0;
d = a->dst_dentry; /* already renamed on the branch */ d = a->dst_dentry; /* already renamed on the branch */
always = !!au_opt_test(au_mntflags(d->d_sb), ALWAYS_DIROPQ);
if (au_ftest_ren(a->auren_flags, ISDIR_SRC) if (au_ftest_ren(a->auren_flags, ISDIR_SRC)
&& !au_ftest_ren(a->auren_flags, DIRREN) && !au_ftest_ren(a->auren_flags, DIRREN)
&& a->btgt != au_dbdiropq(a->src_dentry) && a->btgt != au_dbdiropq(a->src_dentry)
...@@ -308,7 +310,8 @@ static int au_ren_diropq(struct au_ren_args *a) ...@@ -308,7 +310,8 @@ static int au_ren_diropq(struct au_ren_args *a)
|| a->btgt <= au_dbdiropq(d) || a->btgt <= au_dbdiropq(d)
/* hide the lower to keep xino */ /* hide the lower to keep xino */
/* the lowers may not be a dir, but we hide them anyway */ /* the lowers may not be a dir, but we hide them anyway */
|| a->btgt < au_dbbot(d))) { || a->btgt < au_dbbot(d)
|| always)) {
AuDbg("here\n"); AuDbg("here\n");
err = au_ren_do_diropq(a, AuSRC); err = au_ren_do_diropq(a, AuSRC);
if (unlikely(err)) if (unlikely(err))
...@@ -322,7 +325,8 @@ static int au_ren_diropq(struct au_ren_args *a) ...@@ -322,7 +325,8 @@ static int au_ren_diropq(struct au_ren_args *a)
if (au_ftest_ren(a->auren_flags, ISDIR_DST) if (au_ftest_ren(a->auren_flags, ISDIR_DST)
&& a->btgt != au_dbdiropq(a->dst_dentry) && a->btgt != au_dbdiropq(a->dst_dentry)
&& (a->btgt < au_dbdiropq(d) && (a->btgt < au_dbdiropq(d)
|| a->btgt < au_dbbot(d))) { || a->btgt < au_dbbot(d)
|| always)) {
AuDbgDentry(a->src_dentry); AuDbgDentry(a->src_dentry);
AuDbgDentry(a->dst_dentry); AuDbgDentry(a->dst_dentry);
err = au_ren_do_diropq(a, AuDST); err = au_ren_do_diropq(a, AuDST);
......
...@@ -28,6 +28,7 @@ enum { ...@@ -28,6 +28,7 @@ enum {
Opt_plink, Opt_noplink, Opt_list_plink, Opt_plink, Opt_noplink, Opt_list_plink,
Opt_udba, Opt_udba,
Opt_dio, Opt_nodio, Opt_dio, Opt_nodio,
Opt_diropq_a, Opt_diropq_w,
Opt_warn_perm, Opt_nowarn_perm, Opt_warn_perm, Opt_nowarn_perm,
Opt_wbr_copyup, Opt_wbr_create, Opt_wbr_copyup, Opt_wbr_create,
Opt_verbose, Opt_noverbose, Opt_verbose, Opt_noverbose,
...@@ -96,6 +97,11 @@ static match_table_t options = { ...@@ -96,6 +97,11 @@ static match_table_t options = {
{Opt_ignore_silent, "nodirren"}, {Opt_ignore_silent, "nodirren"},
#endif #endif
{Opt_diropq_a, "diropq=always"},
{Opt_diropq_a, "diropq=a"},
{Opt_diropq_w, "diropq=whiteouted"},
{Opt_diropq_w, "diropq=w"},
{Opt_warn_perm, "warn_perm"}, {Opt_warn_perm, "warn_perm"},
{Opt_nowarn_perm, "nowarn_perm"}, {Opt_nowarn_perm, "nowarn_perm"},
...@@ -617,6 +623,12 @@ static void dump_opts(struct au_opts *opts) ...@@ -617,6 +623,12 @@ static void dump_opts(struct au_opts *opts)
case Opt_nodio: case Opt_nodio:
AuLabel(nodio); AuLabel(nodio);
break; break;
case Opt_diropq_a:
AuLabel(diropq_a);
break;
case Opt_diropq_w:
AuLabel(diropq_w);
break;
case Opt_warn_perm: case Opt_warn_perm:
AuLabel(warn_perm); AuLabel(warn_perm);
break; break;
...@@ -1110,6 +1122,8 @@ int au_opts_parse(struct super_block *sb, char *str, struct au_opts *opts) ...@@ -1110,6 +1122,8 @@ int au_opts_parse(struct super_block *sb, char *str, struct au_opts *opts)
case Opt_list_plink: case Opt_list_plink:
case Opt_dio: case Opt_dio:
case Opt_nodio: case Opt_nodio:
case Opt_diropq_a:
case Opt_diropq_w:
case Opt_warn_perm: case Opt_warn_perm:
case Opt_nowarn_perm: case Opt_nowarn_perm:
case Opt_verbose: case Opt_verbose:
...@@ -1273,6 +1287,13 @@ static int au_opt_simple(struct super_block *sb, struct au_opt *opt, ...@@ -1273,6 +1287,13 @@ static int au_opt_simple(struct super_block *sb, struct au_opt *opt,
au_fset_opts(opts->flags, REFRESH_DYAOP); au_fset_opts(opts->flags, REFRESH_DYAOP);
break; break;
case Opt_diropq_a:
au_opt_set(sbinfo->si_mntflags, ALWAYS_DIROPQ);
break;
case Opt_diropq_w:
au_opt_clr(sbinfo->si_mntflags, ALWAYS_DIROPQ);
break;
case Opt_warn_perm: case Opt_warn_perm:
au_opt_set(sbinfo->si_mntflags, WARN_PERM); au_opt_set(sbinfo->si_mntflags, WARN_PERM);
break; break;
......
...@@ -29,6 +29,7 @@ struct file; ...@@ -29,6 +29,7 @@ struct file;
#define AuOpt_PLINK (1 << 6) /* pseudo-link */ #define AuOpt_PLINK (1 << 6) /* pseudo-link */
#define AuOpt_DIRPERM1 (1 << 7) /* ignore the lower dir's perm #define AuOpt_DIRPERM1 (1 << 7) /* ignore the lower dir's perm
bits */ bits */
#define AuOpt_ALWAYS_DIROPQ (1 << 9) /* policy to creating diropq */
#define AuOpt_SUM (1 << 10) /* summation for statfs(2) */ #define AuOpt_SUM (1 << 10) /* summation for statfs(2) */
#define AuOpt_SUM_W (1 << 11) /* unimplemented */ #define AuOpt_SUM_W (1 << 11) /* unimplemented */
#define AuOpt_WARN_PERM (1 << 12) /* warn when add-branch */ #define AuOpt_WARN_PERM (1 << 12) /* warn when add-branch */
......
...@@ -269,6 +269,10 @@ static int aufs_show_options(struct seq_file *m, struct dentry *dentry) ...@@ -269,6 +269,10 @@ static int aufs_show_options(struct seq_file *m, struct dentry *dentry)
if (v != AuWbrCopyup_Def) if (v != AuWbrCopyup_Def)
seq_printf(m, ",cpup=%s", au_optstr_wbr_copyup(v)); seq_printf(m, ",cpup=%s", au_optstr_wbr_copyup(v));
v = au_opt_test(mnt_flags, ALWAYS_DIROPQ);
if (v != au_opt_test(AuOpt_Def, ALWAYS_DIROPQ))
seq_printf(m, ",diropq=%c", v ? 'a' : 'w');
AuUInt(DIRWH, dirwh, sbinfo->si_dirwh); AuUInt(DIRWH, dirwh, sbinfo->si_dirwh);
v = jiffies_to_msecs(sbinfo->si_rdcache) / MSEC_PER_SEC; v = jiffies_to_msecs(sbinfo->si_rdcache) / MSEC_PER_SEC;
......
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