aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/posix_acl.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-01-21 22:05:45 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-21 22:05:45 -0500
commitdf32e43a54d04eda35d2859beaf90e3864d53288 (patch)
tree7a61cf658b2949bd426285eb9902be7758ced1ba /include/linux/posix_acl.h
parentfbd918a2026d0464ce9c23f57b7de4bcfccdc2e6 (diff)
parent78d5506e82b21a1a1de68c24182db2c2fe521422 (diff)
Merge branch 'akpm' (incoming from Andrew)
Merge first patch-bomb from Andrew Morton: - a couple of misc things - inotify/fsnotify work from Jan - ocfs2 updates (partial) - about half of MM * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (117 commits) mm/migrate: remove unused function, fail_migrate_page() mm/migrate: remove putback_lru_pages, fix comment on putback_movable_pages mm/migrate: correct failure handling if !hugepage_migration_support() mm/migrate: add comment about permanent failure path mm, page_alloc: warn for non-blockable __GFP_NOFAIL allocation failure mm: compaction: reset scanner positions immediately when they meet mm: compaction: do not mark unmovable pageblocks as skipped in async compaction mm: compaction: detect when scanners meet in isolate_freepages mm: compaction: reset cached scanner pfn's before reading them mm: compaction: encapsulate defer reset logic mm: compaction: trace compaction begin and end memcg, oom: lock mem_cgroup_print_oom_info sched: add tracepoints related to NUMA task migration mm: numa: do not automatically migrate KSM pages mm: numa: trace tasks that fail migration due to rate limiting mm: numa: limit scope of lock for NUMA migrate rate limiting mm: numa: make NUMA-migrate related functions static lib/show_mem.c: show num_poisoned_pages when oom mm/hwpoison: add '#' to hwpoison_inject mm/memblock: use WARN_ONCE when MAX_NUMNODES passed as input parameter ...
Diffstat (limited to 'include/linux/posix_acl.h')
-rw-r--r--include/linux/posix_acl.h78
1 files changed, 6 insertions, 72 deletions
diff --git a/include/linux/posix_acl.h b/include/linux/posix_acl.h
index 7931efe71175..fb616942e4c7 100644
--- a/include/linux/posix_acl.h
+++ b/include/linux/posix_acl.h
@@ -94,78 +94,12 @@ extern int posix_acl_chmod(struct posix_acl **, gfp_t, umode_t);
94extern struct posix_acl *get_posix_acl(struct inode *, int); 94extern struct posix_acl *get_posix_acl(struct inode *, int);
95extern int set_posix_acl(struct inode *, int, struct posix_acl *); 95extern int set_posix_acl(struct inode *, int, struct posix_acl *);
96 96
97#ifdef CONFIG_FS_POSIX_ACL 97struct posix_acl **acl_by_type(struct inode *inode, int type);
98static inline struct posix_acl **acl_by_type(struct inode *inode, int type) 98struct posix_acl *get_cached_acl(struct inode *inode, int type);
99{ 99struct posix_acl *get_cached_acl_rcu(struct inode *inode, int type);
100 switch (type) { 100void set_cached_acl(struct inode *inode, int type, struct posix_acl *acl);
101 case ACL_TYPE_ACCESS: 101void forget_cached_acl(struct inode *inode, int type);
102 return &inode->i_acl; 102void forget_all_cached_acls(struct inode *inode);
103 case ACL_TYPE_DEFAULT:
104 return &inode->i_default_acl;
105 default:
106 BUG();
107 }
108}
109
110static inline struct posix_acl *get_cached_acl(struct inode *inode, int type)
111{
112 struct posix_acl **p = acl_by_type(inode, type);
113 struct posix_acl *acl = ACCESS_ONCE(*p);
114 if (acl) {
115 spin_lock(&inode->i_lock);
116 acl = *p;
117 if (acl != ACL_NOT_CACHED)
118 acl = posix_acl_dup(acl);
119 spin_unlock(&inode->i_lock);
120 }
121 return acl;
122}
123
124static inline struct posix_acl *get_cached_acl_rcu(struct inode *inode, int type)
125{
126 return rcu_dereference(*acl_by_type(inode, type));
127}
128
129static inline void set_cached_acl(struct inode *inode,
130 int type,
131 struct posix_acl *acl)
132{
133 struct posix_acl **p = acl_by_type(inode, type);
134 struct posix_acl *old;
135 spin_lock(&inode->i_lock);
136 old = *p;
137 rcu_assign_pointer(*p, posix_acl_dup(acl));
138 spin_unlock(&inode->i_lock);
139 if (old != ACL_NOT_CACHED)
140 posix_acl_release(old);
141}
142
143static inline void forget_cached_acl(struct inode *inode, int type)
144{
145 struct posix_acl **p = acl_by_type(inode, type);
146 struct posix_acl *old;
147 spin_lock(&inode->i_lock);
148 old = *p;
149 *p = ACL_NOT_CACHED;
150 spin_unlock(&inode->i_lock);
151 if (old != ACL_NOT_CACHED)
152 posix_acl_release(old);
153}
154
155static inline void forget_all_cached_acls(struct inode *inode)
156{
157 struct posix_acl *old_access, *old_default;
158 spin_lock(&inode->i_lock);
159 old_access = inode->i_acl;
160 old_default = inode->i_default_acl;
161 inode->i_acl = inode->i_default_acl = ACL_NOT_CACHED;
162 spin_unlock(&inode->i_lock);
163 if (old_access != ACL_NOT_CACHED)
164 posix_acl_release(old_access);
165 if (old_default != ACL_NOT_CACHED)
166 posix_acl_release(old_default);
167}
168#endif
169 103
170static inline void cache_no_acl(struct inode *inode) 104static inline void cache_no_acl(struct inode *inode)
171{ 105{