diff options
author | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2016-06-10 05:30:17 -0300 |
---|---|---|
committer | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2016-06-10 05:30:17 -0300 |
commit | d635711daa98be86d4c7fd01499c34f566b54ccb (patch) | |
tree | aa5cc3760a27c3d57146498cb82fa549547de06c /fs/aufs/i_op.c | |
parent | c91265cd0efb83778f015b4d4b1129bd2cfd075e (diff) |
Linux-libre 4.6.2-gnu
Diffstat (limited to 'fs/aufs/i_op.c')
-rw-r--r-- | fs/aufs/i_op.c | 90 |
1 files changed, 39 insertions, 51 deletions
diff --git a/fs/aufs/i_op.c b/fs/aufs/i_op.c index a70d5b050..1572a7d4d 100644 --- a/fs/aufs/i_op.c +++ b/fs/aufs/i_op.c @@ -74,7 +74,7 @@ out: static int aufs_permission(struct inode *inode, int mask) { int err; - aufs_bindex_t bindex, bend; + aufs_bindex_t bindex, bbot; const unsigned char isdir = !!S_ISDIR(inode->i_mode), write_mask = !!(mask & (MAY_WRITE | MAY_APPEND)); struct inode *h_inode; @@ -98,14 +98,14 @@ static int aufs_permission(struct inode *inode, int mask) || write_mask || au_opt_test(au_mntflags(sb), DIRPERM1)) { err = au_busy_or_stale(); - h_inode = au_h_iptr(inode, au_ibstart(inode)); + h_inode = au_h_iptr(inode, au_ibtop(inode)); if (unlikely(!h_inode || (h_inode->i_mode & S_IFMT) != (inode->i_mode & S_IFMT))) goto out; err = 0; - bindex = au_ibstart(inode); + bindex = au_ibtop(inode); br = au_sbr(sb, bindex); err = h_permission(h_inode, mask, au_br_mnt(br), br->br_perm); if (write_mask @@ -124,8 +124,8 @@ static int aufs_permission(struct inode *inode, int mask) /* non-write to dir */ err = 0; - bend = au_ibend(inode); - for (bindex = au_ibstart(inode); !err && bindex <= bend; bindex++) { + bbot = au_ibbot(inode); + for (bindex = au_ibtop(inode); !err && bindex <= bbot; bindex++) { h_inode = au_h_iptr(inode, bindex); if (h_inode) { err = au_busy_or_stale(); @@ -184,7 +184,7 @@ static struct dentry *aufs_lookup(struct inode *dir, struct dentry *dentry, if (!err) err = au_digen_test(parent, au_sigen(sb)); if (!err) { - npositive = au_lkup_dentry(dentry, au_dbstart(parent), + npositive = au_lkup_dentry(dentry, au_dbtop(parent), /*type*/0); err = npositive; } @@ -226,18 +226,6 @@ static struct dentry *aufs_lookup(struct inode *dir, struct dentry *dentry, out_unlock: di_write_unlock(dentry); - if (inode) { - /* verbose coding for lock class name */ - if (unlikely(S_ISLNK(inode->i_mode))) - au_rw_class(&au_di(dentry)->di_rwsem, - au_lc_key + AuLcSymlink_DIINFO); - else if (unlikely(S_ISDIR(inode->i_mode))) - au_rw_class(&au_di(dentry)->di_rwsem, - au_lc_key + AuLcDir_DIINFO); - else /* likely */ - au_rw_class(&au_di(dentry)->di_rwsem, - au_lc_key + AuLcNonDir_DIINFO); - } out_si: si_read_unlock(sb); out: @@ -324,7 +312,7 @@ static int aufs_atomic_open(struct inode *dir, struct dentry *dentry, parent = dentry->d_parent; /* dir is locked */ di_write_lock_parent(parent); - err = au_lkup_dentry(dentry, /*bstart*/0, /*type*/0); + err = au_lkup_dentry(dentry, /*btop*/0, /*type*/0); if (unlikely(err)) goto out_unlock; @@ -391,7 +379,7 @@ out: static int au_wr_dir_cpup(struct dentry *dentry, struct dentry *parent, const unsigned char add_entry, aufs_bindex_t bcpup, - aufs_bindex_t bstart) + aufs_bindex_t btop) { int err; struct dentry *h_parent; @@ -404,9 +392,9 @@ static int au_wr_dir_cpup(struct dentry *dentry, struct dentry *parent, err = 0; if (!au_h_dptr(parent, bcpup)) { - if (bstart > bcpup) + if (btop > bcpup) err = au_cpup_dirs(dentry, bcpup); - else if (bstart < bcpup) + else if (btop < bcpup) err = au_cpdown_dirs(dentry, bcpup); else BUG(); @@ -422,7 +410,7 @@ static int au_wr_dir_cpup(struct dentry *dentry, struct dentry *parent, AuDbg("bcpup %d\n", bcpup); if (!err) { if (d_really_is_negative(dentry)) - au_set_h_dptr(dentry, bstart, NULL); + au_set_h_dptr(dentry, btop, NULL); au_update_dbrange(dentry, /*do_put_zero*/0); } } @@ -446,7 +434,7 @@ int au_wr_dir(struct dentry *dentry, struct dentry *src_dentry, { int err; unsigned int flags; - aufs_bindex_t bcpup, bstart, src_bstart; + aufs_bindex_t bcpup, btop, src_btop; const unsigned char add_entry = au_ftest_wrdir(args->flags, ADD_ENTRY) | au_ftest_wrdir(args->flags, TMPFILE); @@ -457,13 +445,13 @@ int au_wr_dir(struct dentry *dentry, struct dentry *src_dentry, sb = dentry->d_sb; sbinfo = au_sbi(sb); parent = dget_parent(dentry); - bstart = au_dbstart(dentry); - bcpup = bstart; + btop = au_dbtop(dentry); + bcpup = btop; if (args->force_btgt < 0) { if (src_dentry) { - src_bstart = au_dbstart(src_dentry); - if (src_bstart < bstart) - bcpup = src_bstart; + src_btop = au_dbtop(src_dentry); + if (src_btop < btop) + bcpup = src_btop; } else if (add_entry) { flags = 0; if (au_ftest_wrdir(args->flags, ISDIR)) @@ -492,18 +480,18 @@ int au_wr_dir(struct dentry *dentry, struct dentry *src_dentry, AuDebugOn(au_test_ro(sb, bcpup, d_inode(dentry))); } - AuDbg("bstart %d, bcpup %d\n", bstart, bcpup); + AuDbg("btop %d, bcpup %d\n", btop, bcpup); err = bcpup; - if (bcpup == bstart) + if (bcpup == btop) goto out; /* success */ /* copyup the new parent into the branch we process */ - err = au_wr_dir_cpup(dentry, parent, add_entry, bcpup, bstart); + err = au_wr_dir_cpup(dentry, parent, add_entry, bcpup, btop); if (err >= 0) { if (d_really_is_negative(dentry)) { - au_set_h_dptr(dentry, bstart, NULL); - au_set_dbstart(dentry, bcpup); - au_set_dbend(dentry, bcpup); + au_set_h_dptr(dentry, btop, NULL); + au_set_dbtop(dentry, bcpup); + au_set_dbbot(dentry, bcpup); } AuDebugOn(add_entry && !au_ftest_wrdir(args->flags, TMPFILE) @@ -645,7 +633,7 @@ int au_do_pin(struct au_pin *p) } p->h_dentry = NULL; - if (p->bindex <= au_dbend(p->dentry)) + if (p->bindex <= au_dbbot(p->dentry)) p->h_dentry = au_h_dptr(p->dentry, p->bindex); p->parent = dget_parent(p->dentry); @@ -761,7 +749,7 @@ int au_pin_and_icpup(struct dentry *dentry, struct iattr *ia, { int err; loff_t sz; - aufs_bindex_t bstart, ibstart; + aufs_bindex_t btop, ibtop; struct dentry *hi_wh, *parent; struct inode *inode; struct au_wr_dir_args wr_dir_args = { @@ -772,16 +760,16 @@ int au_pin_and_icpup(struct dentry *dentry, struct iattr *ia, if (d_is_dir(dentry)) au_fset_wrdir(wr_dir_args.flags, ISDIR); /* plink or hi_wh() case */ - bstart = au_dbstart(dentry); + btop = au_dbtop(dentry); inode = d_inode(dentry); - ibstart = au_ibstart(inode); - if (bstart != ibstart && !au_test_ro(inode->i_sb, ibstart, inode)) - wr_dir_args.force_btgt = ibstart; + ibtop = au_ibtop(inode); + if (btop != ibtop && !au_test_ro(inode->i_sb, ibtop, inode)) + wr_dir_args.force_btgt = ibtop; err = au_wr_dir(dentry, /*src_dentry*/NULL, &wr_dir_args); if (unlikely(err < 0)) goto out; a->btgt = err; - if (err != bstart) + if (err != btop) au_fset_icpup(a->flags, DID_CPUP); err = 0; @@ -797,8 +785,8 @@ int au_pin_and_icpup(struct dentry *dentry, struct iattr *ia, if (unlikely(err)) goto out_parent; - a->h_path.dentry = au_h_dptr(dentry, bstart); sz = -1; + a->h_path.dentry = au_h_dptr(dentry, btop); a->h_inode = d_inode(a->h_path.dentry); if (ia && (ia->ia_valid & ATTR_SIZE)) { inode_lock_nested(a->h_inode, AuLsc_I_CHILD); @@ -839,7 +827,7 @@ int au_pin_and_icpup(struct dentry *dentry, struct iattr *ia, struct au_cp_generic cpg = { .dentry = dentry, .bdst = a->btgt, - .bsrc = bstart, + .bsrc = btop, .len = sz, .pin = &a->pin, .flags = AuCpup_DTIME | AuCpup_HOPEN @@ -976,7 +964,7 @@ out_unlock: inode_unlock(a->h_inode); au_unpin(&a->pin); if (unlikely(err)) - au_update_dbstart(dentry); + au_update_dbtop(dentry); out_dentry: di_write_unlock(dentry); if (file) { @@ -1073,7 +1061,7 @@ ssize_t au_srxattr(struct dentry *dentry, struct au_srxattr *arg) au_unpin(&a->pin); if (unlikely(err)) - au_update_dbstart(dentry); + au_update_dbtop(dentry); out_di: di_write_unlock(dentry); @@ -1165,7 +1153,7 @@ int au_h_path_getattr(struct dentry *dentry, int force, struct path *h_path) di_read_lock_child(dentry, AuLock_IR); inode = d_inode(dentry); - bindex = au_ibstart(inode); + bindex = au_ibtop(inode); h_path->mnt = au_sbr_mnt(sb, bindex); h_sb = h_path->mnt->mnt_sb; if (!force @@ -1173,7 +1161,7 @@ int au_h_path_getattr(struct dentry *dentry, int force, struct path *h_path) && udba_none) goto out; /* success */ - if (au_dbstart(dentry) == bindex) + if (au_dbtop(dentry) == bindex) h_path->dentry = au_h_dptr(dentry, bindex); else if (au_opt_test(mnt_flags, PLINK) && au_plink_test(inode)) { h_path->dentry = au_plink_lkup(inode, bindex); @@ -1258,14 +1246,14 @@ static const char *aufs_get_link(struct dentry *dentry, struct inode *inode, err = -EINVAL; inode = d_inode(dentry); - bindex = au_ibstart(inode); + bindex = au_ibtop(inode); h_inode = au_h_iptr(inode, bindex); if (unlikely(!h_inode->i_op->get_link)) goto out_unlock; err = -EBUSY; h_dentry = NULL; - if (au_dbstart(dentry) <= bindex) { + if (au_dbtop(dentry) <= bindex) { h_dentry = au_h_dptr(dentry, bindex); if (h_dentry) dget(h_dentry); @@ -1311,7 +1299,7 @@ static int aufs_update_time(struct inode *inode, struct timespec *ts, int flags) si_read_lock(sb, AuLock_FLUSH); ii_write_lock_child(inode); lockdep_on(); - h_inode = au_h_iptr(inode, au_ibstart(inode)); + h_inode = au_h_iptr(inode, au_ibtop(inode)); err = vfsub_update_time(h_inode, ts, flags); lockdep_off(); if (!err) |