summaryrefslogtreecommitdiff
path: root/fs/aufs/branch.h
diff options
context:
space:
mode:
authorAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-06-10 05:30:17 -0300
committerAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-06-10 05:30:17 -0300
commitd635711daa98be86d4c7fd01499c34f566b54ccb (patch)
treeaa5cc3760a27c3d57146498cb82fa549547de06c /fs/aufs/branch.h
parentc91265cd0efb83778f015b4d4b1129bd2cfd075e (diff)
Linux-libre 4.6.2-gnu
Diffstat (limited to 'fs/aufs/branch.h')
-rw-r--r--fs/aufs/branch.h34
1 files changed, 32 insertions, 2 deletions
diff --git a/fs/aufs/branch.h b/fs/aufs/branch.h
index 4c52ae166..32a4d8f36 100644
--- a/fs/aufs/branch.h
+++ b/fs/aufs/branch.h
@@ -86,7 +86,7 @@ struct au_branch {
struct path br_path;
spinlock_t br_dykey_lock;
struct au_dykey *br_dykey[AuBrDynOp];
- atomic_t br_count;
+ struct percpu_counter br_count;
struct au_wbr *br_wbr;
struct au_br_fhsm *br_fhsm;
@@ -121,6 +121,31 @@ static inline struct super_block *au_br_sb(struct au_branch *br)
return au_br_mnt(br)->mnt_sb;
}
+static inline void au_br_get(struct au_branch *br)
+{
+ percpu_counter_inc(&br->br_count);
+}
+
+static inline void au_br_put(struct au_branch *br)
+{
+ percpu_counter_dec(&br->br_count);
+}
+
+static inline s64 au_br_count(struct au_branch *br)
+{
+ return percpu_counter_sum(&br->br_count);
+}
+
+static inline void au_br_count_init(struct au_branch *br)
+{
+ percpu_counter_init(&br->br_count, 0, GFP_NOFS);
+}
+
+static inline void au_br_count_fin(struct au_branch *br)
+{
+ percpu_counter_destroy(&br->br_count);
+}
+
static inline int au_br_rdonly(struct au_branch *br)
{
return ((au_br_sb(br)->s_flags & MS_RDONLY)
@@ -216,9 +241,14 @@ struct super_block *au_sbr_sb(struct super_block *sb, aufs_bindex_t bindex)
return au_br_sb(au_sbr(sb, bindex));
}
+static inline void au_sbr_get(struct super_block *sb, aufs_bindex_t bindex)
+{
+ au_br_get(au_sbr(sb, bindex));
+}
+
static inline void au_sbr_put(struct super_block *sb, aufs_bindex_t bindex)
{
- atomic_dec(&au_sbr(sb, bindex)->br_count);
+ au_br_put(au_sbr(sb, bindex));
}
static inline int au_sbr_perm(struct super_block *sb, aufs_bindex_t bindex)