diff options
Diffstat (limited to 'fs/aufs/branch.h')
-rw-r--r-- | fs/aufs/branch.h | 34 |
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) |