Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 199169
b: refs/heads/master
c: d7065da
h: refs/heads/master
i:
  199167: 6c41732
v: v3
  • Loading branch information
Al Viro committed May 28, 2010
1 parent ddcabe7 commit 786a112
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 176306f59ac7a35369cbba87aff13e14c5916074
refs/heads/master: d7065da038227a4d09a244e6014e0186a6bd21d0
6 changes: 3 additions & 3 deletions trunk/fs/aio.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ static void aio_fput_routine(struct work_struct *data)

/* Complete the fput(s) */
if (req->ki_filp != NULL)
__fput(req->ki_filp);
fput(req->ki_filp);

/* Link the iocb into the context's free list */
spin_lock_irq(&ctx->ctx_lock);
Expand Down Expand Up @@ -560,11 +560,11 @@ static int __aio_put_req(struct kioctx *ctx, struct kiocb *req)

/*
* Try to optimize the aio and eventfd file* puts, by avoiding to
* schedule work in case it is not __fput() time. In normal cases,
* schedule work in case it is not final fput() time. In normal cases,
* we would not be holding the last reference to the file*, so
* this function will be executed w/out any aio kthread wakeup.
*/
if (unlikely(atomic_long_dec_and_test(&req->ki_filp->f_count))) {
if (unlikely(!fput_atomic(req->ki_filp))) {
get_ioctx(ctx);
spin_lock(&fput_lock);
list_add(&req->ki_list, &fput_head);
Expand Down
21 changes: 10 additions & 11 deletions trunk/fs/file_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,6 @@ struct file *alloc_file(struct path *path, fmode_t mode,
}
EXPORT_SYMBOL(alloc_file);

void fput(struct file *file)
{
if (atomic_long_dec_and_test(&file->f_count))
__fput(file);
}

EXPORT_SYMBOL(fput);

/**
* drop_file_write_access - give up ability to write to a file
* @file: the file to which we will stop writing
Expand All @@ -227,10 +219,9 @@ void drop_file_write_access(struct file *file)
}
EXPORT_SYMBOL_GPL(drop_file_write_access);

/* __fput is called from task context when aio completion releases the last
* last use of a struct file *. Do not use otherwise.
/* the real guts of fput() - releasing the last reference to file
*/
void __fput(struct file *file)
static void __fput(struct file *file)
{
struct dentry *dentry = file->f_path.dentry;
struct vfsmount *mnt = file->f_path.mnt;
Expand Down Expand Up @@ -268,6 +259,14 @@ void __fput(struct file *file)
mntput(mnt);
}

void fput(struct file *file)
{
if (atomic_long_dec_and_test(&file->f_count))
__fput(file);
}

EXPORT_SYMBOL(fput);

struct file *fget(unsigned int fd)
{
struct file *file;
Expand Down
1 change: 0 additions & 1 deletion trunk/include/linux/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

struct file;

extern void __fput(struct file *);
extern void fput(struct file *);
extern void drop_file_write_access(struct file *file);

Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,7 @@ extern spinlock_t files_lock;
#define file_list_unlock() spin_unlock(&files_lock);

#define get_file(x) atomic_long_inc(&(x)->f_count)
#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1)
#define file_count(x) atomic_long_read(&(x)->f_count)

#ifdef CONFIG_DEBUG_WRITECOUNT
Expand Down

0 comments on commit 786a112

Please sign in to comment.