aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorNick Piggin <nickpiggin@yahoo.com.au>2006-01-08 04:02:19 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-08 23:13:48 -0500
commit095975da26dba21698582e91e96be10f7417333f (patch)
treece1ffac556d394ef56a18faa97d38f79b07f31e2 /fs
parenta57004e1afb6ee03c509f1b1ec74a000682ab93b (diff)
[PATCH] rcu file: use atomic primitives
Use atomic_inc_not_zero for rcu files instead of special case rcuref. Signed-off-by: Nick Piggin <npiggin@suse.de> Cc: "Paul E. McKenney" <paulmck@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/aio.c3
-rw-r--r--fs/file_table.c8
2 files changed, 5 insertions, 6 deletions
diff --git a/fs/aio.c b/fs/aio.c
index 5a28b69ad22..aec2b1916d1 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -29,7 +29,6 @@
29#include <linux/highmem.h> 29#include <linux/highmem.h>
30#include <linux/workqueue.h> 30#include <linux/workqueue.h>
31#include <linux/security.h> 31#include <linux/security.h>
32#include <linux/rcuref.h>
33 32
34#include <asm/kmap_types.h> 33#include <asm/kmap_types.h>
35#include <asm/uaccess.h> 34#include <asm/uaccess.h>
@@ -514,7 +513,7 @@ static int __aio_put_req(struct kioctx *ctx, struct kiocb *req)
514 /* Must be done under the lock to serialise against cancellation. 513 /* Must be done under the lock to serialise against cancellation.
515 * Call this aio_fput as it duplicates fput via the fput_work. 514 * Call this aio_fput as it duplicates fput via the fput_work.
516 */ 515 */
517 if (unlikely(rcuref_dec_and_test(&req->ki_filp->f_count))) { 516 if (unlikely(atomic_dec_and_test(&req->ki_filp->f_count))) {
518 get_ioctx(ctx); 517 get_ioctx(ctx);
519 spin_lock(&fput_lock); 518 spin_lock(&fput_lock);
520 list_add(&req->ki_list, &fput_head); 519 list_add(&req->ki_list, &fput_head);
diff --git a/fs/file_table.c b/fs/file_table.c
index c3a5e2fd663..6142250104a 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -117,7 +117,7 @@ EXPORT_SYMBOL(get_empty_filp);
117 117
118void fastcall fput(struct file *file) 118void fastcall fput(struct file *file)
119{ 119{
120 if (rcuref_dec_and_test(&file->f_count)) 120 if (atomic_dec_and_test(&file->f_count))
121 __fput(file); 121 __fput(file);
122} 122}
123 123
@@ -166,7 +166,7 @@ struct file fastcall *fget(unsigned int fd)
166 rcu_read_lock(); 166 rcu_read_lock();
167 file = fcheck_files(files, fd); 167 file = fcheck_files(files, fd);
168 if (file) { 168 if (file) {
169 if (!rcuref_inc_lf(&file->f_count)) { 169 if (!atomic_inc_not_zero(&file->f_count)) {
170 /* File object ref couldn't be taken */ 170 /* File object ref couldn't be taken */
171 rcu_read_unlock(); 171 rcu_read_unlock();
172 return NULL; 172 return NULL;
@@ -198,7 +198,7 @@ struct file fastcall *fget_light(unsigned int fd, int *fput_needed)
198 rcu_read_lock(); 198 rcu_read_lock();
199 file = fcheck_files(files, fd); 199 file = fcheck_files(files, fd);
200 if (file) { 200 if (file) {
201 if (rcuref_inc_lf(&file->f_count)) 201 if (atomic_inc_not_zero(&file->f_count))
202 *fput_needed = 1; 202 *fput_needed = 1;
203 else 203 else
204 /* Didn't get the reference, someone's freed */ 204 /* Didn't get the reference, someone's freed */
@@ -213,7 +213,7 @@ struct file fastcall *fget_light(unsigned int fd, int *fput_needed)
213 213
214void put_filp(struct file *file) 214void put_filp(struct file *file)
215{ 215{
216 if (rcuref_dec_and_test(&file->f_count)) { 216 if (atomic_dec_and_test(&file->f_count)) {
217 security_file_free(file); 217 security_file_free(file);
218 file_kill(file); 218 file_kill(file);
219 file_free(file); 219 file_free(file);