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

aufs: white-out 2/2, diropq



The marker to represent that the directory is opaque (stop digging
down the branch stack) is implemented as a special whiteout.

See also the document in previous commit.
Signed-off-by: default avatarJ. R. Okajima <hooanon05g@gmail.com>
parent 2a7e7277
......@@ -138,9 +138,9 @@ void au_dpri_dentry(struct dentry *dentry)
dinfo = au_di(dentry);
if (!dinfo)
return;
dpri("d-1: btop %d, bbot %d, bwh %d, gen %d\n",
dpri("d-1: btop %d, bbot %d, bwh %d, bdiropq %d, gen %d\n",
dinfo->di_btop, dinfo->di_bbot,
dinfo->di_bwh, au_digen(dentry));
dinfo->di_bwh, dinfo->di_bdiropq, au_digen(dentry));
if (dinfo->di_btop < 0)
return;
for (bindex = dinfo->di_btop; bindex <= dinfo->di_bbot; bindex++)
......
......@@ -24,7 +24,7 @@ struct au_dinfo {
atomic_t di_generation;
struct au_rwsem di_rwsem;
aufs_bindex_t di_btop, di_bbot, di_bwh;
aufs_bindex_t di_btop, di_bbot, di_bwh, di_bdiropq;
struct au_hdentry *di_hdentry;
struct rcu_head rcu;
} ____cacheline_aligned_in_smp;
......@@ -46,6 +46,8 @@ void di_write_lock(struct dentry *d, unsigned int lsc);
void di_write_unlock(struct dentry *d);
struct dentry *au_h_dptr(struct dentry *dentry, aufs_bindex_t bindex);
aufs_bindex_t au_dbtail(struct dentry *dentry);
aufs_bindex_t au_dbtaildir(struct dentry *dentry);
void au_set_h_dptr(struct dentry *dentry, aufs_bindex_t bindex,
struct dentry *h_dentry);
......@@ -153,6 +155,12 @@ static inline aufs_bindex_t au_dbwh(struct dentry *dentry)
return au_di(dentry)->di_bwh;
}
static inline aufs_bindex_t au_dbdiropq(struct dentry *dentry)
{
DiMustAnyLock(dentry);
return au_di(dentry)->di_bdiropq;
}
/* todo: hard/soft set? */
static inline void au_set_dbtop(struct dentry *dentry, aufs_bindex_t bindex)
{
......@@ -173,5 +181,11 @@ static inline void au_set_dbwh(struct dentry *dentry, aufs_bindex_t bindex)
au_di(dentry)->di_bwh = bindex;
}
static inline void au_set_dbdiropq(struct dentry *dentry, aufs_bindex_t bindex)
{
DiMustWriteLock(dentry);
au_di(dentry)->di_bdiropq = bindex;
}
#endif /* __KERNEL__ */
#endif /* __AUFS_DENTRY_H__ */
......@@ -34,6 +34,7 @@ struct au_dinfo *au_di_alloc(struct super_block *sb, unsigned int lsc)
dinfo->di_btop = -1;
dinfo->di_bbot = -1;
dinfo->di_bwh = -1;
dinfo->di_bdiropq = -1;
for (i = 0; i < nbr; i++)
dinfo->di_hdentry[i].hd_id = -1;
goto out;
......@@ -235,6 +236,34 @@ struct dentry *au_h_dptr(struct dentry *dentry, aufs_bindex_t bindex)
return d;
}
aufs_bindex_t au_dbtail(struct dentry *dentry)
{
aufs_bindex_t bbot, bwh;
bbot = au_dbbot(dentry);
if (0 <= bbot) {
bwh = au_dbwh(dentry);
if (!bwh)
return bwh;
if (0 < bwh && bwh < bbot)
return bwh - 1;
}
return bbot;
}
aufs_bindex_t au_dbtaildir(struct dentry *dentry)
{
aufs_bindex_t bbot, bopq;
bbot = au_dbtail(dentry);
if (0 <= bbot) {
bopq = au_dbdiropq(dentry);
if (0 <= bopq && bopq < bbot)
bbot = bopq;
}
return bbot;
}
/* ---------------------------------------------------------------------- */
void au_set_h_dptr(struct dentry *dentry, aufs_bindex_t bindex,
......
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