From b907a8622e39eecfc4b243f3be3ad26559d1faee Mon Sep 17 00:00:00 2001 From: André Fabian Silva Delgado Date: Mon, 27 Jun 2016 21:01:09 -0300 Subject: Linux-libre 4.6.3-gnu --- fs/aufs/dinfo.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'fs/aufs/dinfo.c') diff --git a/fs/aufs/dinfo.c b/fs/aufs/dinfo.c index b2eb8c2de..43b550973 100644 --- a/fs/aufs/dinfo.c +++ b/fs/aufs/dinfo.c @@ -56,7 +56,7 @@ void au_di_free(struct au_dinfo *dinfo) bindex = dinfo->di_btop; if (bindex >= 0) { bbot = dinfo->di_bbot; - p = dinfo->di_hdentry + bindex; + p = au_hdentry(dinfo, bindex); while (bindex++ <= bbot) au_hdput(p++); } @@ -308,7 +308,7 @@ struct dentry *au_h_dptr(struct dentry *dentry, aufs_bindex_t bindex) if (au_dbtop(dentry) < 0 || bindex < au_dbtop(dentry)) return NULL; AuDebugOn(bindex < 0); - d = au_di(dentry)->di_hdentry[0 + bindex].hd_dentry; + d = au_hdentry(au_di(dentry), bindex)->hd_dentry; AuDebugOn(d && au_dcount(d) <= 0); return d; } @@ -397,11 +397,14 @@ aufs_bindex_t au_dbtaildir(struct dentry *dentry) void au_set_h_dptr(struct dentry *dentry, aufs_bindex_t bindex, struct dentry *h_dentry) { - struct au_hdentry *hd = au_di(dentry)->di_hdentry + bindex; + struct au_dinfo *dinfo; + struct au_hdentry *hd; struct au_branch *br; DiMustWriteLock(dentry); + dinfo = au_di(dentry); + hd = au_hdentry(dinfo, bindex); au_hdput(hd); hd->hd_dentry = h_dentry; if (h_dentry) { @@ -451,6 +454,7 @@ void au_update_dbrange(struct dentry *dentry, int do_put_zero) struct au_dinfo *dinfo; struct dentry *h_d; struct au_hdentry *hdp; + aufs_bindex_t bindex, bbot; DiMustWriteLock(dentry); @@ -458,21 +462,21 @@ void au_update_dbrange(struct dentry *dentry, int do_put_zero) if (!dinfo || dinfo->di_btop < 0) return; - hdp = dinfo->di_hdentry; if (do_put_zero) { - aufs_bindex_t bindex, bbot; - bbot = dinfo->di_bbot; - for (bindex = dinfo->di_btop; bindex <= bbot; bindex++) { - h_d = hdp[0 + bindex].hd_dentry; + bindex = dinfo->di_btop; + hdp = au_hdentry(dinfo, bindex); + for (; bindex <= bbot; bindex++, hdp++) { + h_d = hdp->hd_dentry; if (h_d && d_is_negative(h_d)) au_set_h_dptr(dentry, bindex, NULL); } } - dinfo->di_btop = -1; - while (++dinfo->di_btop <= dinfo->di_bbot) - if (hdp[0 + dinfo->di_btop].hd_dentry) + dinfo->di_btop = 0; + hdp = au_hdentry(dinfo, dinfo->di_btop); + for (; dinfo->di_btop <= dinfo->di_bbot; dinfo->di_btop++, hdp++) + if (hdp->hd_dentry) break; if (dinfo->di_btop > dinfo->di_bbot) { dinfo->di_btop = -1; @@ -480,9 +484,9 @@ void au_update_dbrange(struct dentry *dentry, int do_put_zero) return; } - dinfo->di_bbot++; - while (0 <= --dinfo->di_bbot) - if (hdp[0 + dinfo->di_bbot].hd_dentry) + hdp = au_hdentry(dinfo, dinfo->di_bbot); + for (; dinfo->di_bbot >= 0; dinfo->di_bbot--, hdp--) + if (hdp->hd_dentry) break; AuDebugOn(dinfo->di_btop > dinfo->di_bbot || dinfo->di_bbot < 0); } -- cgit v1.2.3-54-g00ecf