aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2014-01-21 18:48:42 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-21 19:19:42 -0500
commit0afaa12047a45ebe651f29a3b4818e523f862c28 (patch)
treea5c38045bca3b7b852f76bf1107c004e58bdea98 /fs
parent53a52f17d96c8d47c79a7dafa81426317e89c7c1 (diff)
posix_acl: uninlining
Uninline vast tracts of nested inline functions in include/linux/posix_acl.h. This reduces the text+data+bss size of x86_64 allyesconfig vmlinux by 8026 bytes. The patch also regularises the positioning of the EXPORT_SYMBOLs in posix_acl.c. Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: J. Bruce Fields <bfields@fieldses.org> Cc: Trond Myklebust <Trond.Myklebust@netapp.com> Tested-by: Benny Halevy <bhalevy@primarydata.com> Cc: Benny Halevy <bhalevy@panasas.com> Cc: Andreas Gruenbacher <agruen@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/posix_acl.c84
1 files changed, 79 insertions, 5 deletions
diff --git a/fs/posix_acl.c b/fs/posix_acl.c
index 8bd2135b7f82..021e7c069b86 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -22,11 +22,80 @@
22 22
23#include <linux/errno.h> 23#include <linux/errno.h>
24 24
25EXPORT_SYMBOL(posix_acl_init); 25struct posix_acl **acl_by_type(struct inode *inode, int type)
26EXPORT_SYMBOL(posix_acl_alloc); 26{
27EXPORT_SYMBOL(posix_acl_valid); 27 switch (type) {
28EXPORT_SYMBOL(posix_acl_equiv_mode); 28 case ACL_TYPE_ACCESS:
29EXPORT_SYMBOL(posix_acl_from_mode); 29 return &inode->i_acl;
30 case ACL_TYPE_DEFAULT:
31 return &inode->i_default_acl;
32 default:
33 BUG();
34 }
35}
36EXPORT_SYMBOL(acl_by_type);
37
38struct posix_acl *get_cached_acl(struct inode *inode, int type)
39{
40 struct posix_acl **p = acl_by_type(inode, type);
41 struct posix_acl *acl = ACCESS_ONCE(*p);
42 if (acl) {
43 spin_lock(&inode->i_lock);
44 acl = *p;
45 if (acl != ACL_NOT_CACHED)
46 acl = posix_acl_dup(acl);
47 spin_unlock(&inode->i_lock);
48 }
49 return acl;
50}
51EXPORT_SYMBOL(get_cached_acl);
52
53struct posix_acl *get_cached_acl_rcu(struct inode *inode, int type)
54{
55 return rcu_dereference(*acl_by_type(inode, type));
56}
57EXPORT_SYMBOL(get_cached_acl_rcu);
58
59void set_cached_acl(struct inode *inode, int type, struct posix_acl *acl)
60{
61 struct posix_acl **p = acl_by_type(inode, type);
62 struct posix_acl *old;
63 spin_lock(&inode->i_lock);
64 old = *p;
65 rcu_assign_pointer(*p, posix_acl_dup(acl));
66 spin_unlock(&inode->i_lock);
67 if (old != ACL_NOT_CACHED)
68 posix_acl_release(old);
69}
70EXPORT_SYMBOL(set_cached_acl);
71
72void forget_cached_acl(struct inode *inode, int type)
73{
74 struct posix_acl **p = acl_by_type(inode, type);
75 struct posix_acl *old;
76 spin_lock(&inode->i_lock);
77 old = *p;
78 *p = ACL_NOT_CACHED;
79 spin_unlock(&inode->i_lock);
80 if (old != ACL_NOT_CACHED)
81 posix_acl_release(old);
82}
83EXPORT_SYMBOL(forget_cached_acl);
84
85void forget_all_cached_acls(struct inode *inode)
86{
87 struct posix_acl *old_access, *old_default;
88 spin_lock(&inode->i_lock);
89 old_access = inode->i_acl;
90 old_default = inode->i_default_acl;
91 inode->i_acl = inode->i_default_acl = ACL_NOT_CACHED;
92 spin_unlock(&inode->i_lock);
93 if (old_access != ACL_NOT_CACHED)
94 posix_acl_release(old_access);
95 if (old_default != ACL_NOT_CACHED)
96 posix_acl_release(old_default);
97}
98EXPORT_SYMBOL(forget_all_cached_acls);
30 99
31/* 100/*
32 * Init a fresh posix_acl 101 * Init a fresh posix_acl
@@ -37,6 +106,7 @@ posix_acl_init(struct posix_acl *acl, int count)
37 atomic_set(&acl->a_refcount, 1); 106 atomic_set(&acl->a_refcount, 1);
38 acl->a_count = count; 107 acl->a_count = count;
39} 108}
109EXPORT_SYMBOL(posix_acl_init);
40 110
41/* 111/*
42 * Allocate a new ACL with the specified number of entries. 112 * Allocate a new ACL with the specified number of entries.
@@ -51,6 +121,7 @@ posix_acl_alloc(int count, gfp_t flags)
51 posix_acl_init(acl, count); 121 posix_acl_init(acl, count);
52 return acl; 122 return acl;
53} 123}
124EXPORT_SYMBOL(posix_acl_alloc);
54 125
55/* 126/*
56 * Clone an ACL. 127 * Clone an ACL.
@@ -146,6 +217,7 @@ posix_acl_valid(const struct posix_acl *acl)
146 return 0; 217 return 0;
147 return -EINVAL; 218 return -EINVAL;
148} 219}
220EXPORT_SYMBOL(posix_acl_valid);
149 221
150/* 222/*
151 * Returns 0 if the acl can be exactly represented in the traditional 223 * Returns 0 if the acl can be exactly represented in the traditional
@@ -186,6 +258,7 @@ posix_acl_equiv_mode(const struct posix_acl *acl, umode_t *mode_p)
186 *mode_p = (*mode_p & ~S_IRWXUGO) | mode; 258 *mode_p = (*mode_p & ~S_IRWXUGO) | mode;
187 return not_equiv; 259 return not_equiv;
188} 260}
261EXPORT_SYMBOL(posix_acl_equiv_mode);
189 262
190/* 263/*
191 * Create an ACL representing the file mode permission bits of an inode. 264 * Create an ACL representing the file mode permission bits of an inode.
@@ -207,6 +280,7 @@ posix_acl_from_mode(umode_t mode, gfp_t flags)
207 acl->a_entries[2].e_perm = (mode & S_IRWXO); 280 acl->a_entries[2].e_perm = (mode & S_IRWXO);
208 return acl; 281 return acl;
209} 282}
283EXPORT_SYMBOL(posix_acl_from_mode);
210 284
211/* 285/*
212 * Return 0 if current is granted want access to the inode 286 * Return 0 if current is granted want access to the inode