diff options
author | Jens Axboe <axboe@kernel.dk> | 2018-11-21 10:32:39 -0700 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2019-02-28 08:24:23 -0700 |
commit | 091141a42e15fe47ada737f3996b317072afcefb (patch) | |
tree | d7a89e516c2e1064841dfa938cf043b5c4572675 /include/linux/file.h | |
parent | def596e9557c91d9846fc4d84d26f2c564644416 (diff) |
fs: add fget_many() and fput_many()
Some uses cases repeatedly get and put references to the same file, but
the only exposed interface is doing these one at the time. As each of
these entail an atomic inc or dec on a shared structure, that cost can
add up.
Add fget_many(), which works just like fget(), except it takes an
argument for how many references to get on the file. Ditto fput_many(),
which can drop an arbitrary number of references to a file.
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/file.h')
-rw-r--r-- | include/linux/file.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/file.h b/include/linux/file.h index 6b2fb032416c..3fcddff56bc4 100644 --- a/include/linux/file.h +++ b/include/linux/file.h @@ -13,6 +13,7 @@ struct file; extern void fput(struct file *); +extern void fput_many(struct file *, unsigned int); struct file_operations; struct vfsmount; @@ -44,6 +45,7 @@ static inline void fdput(struct fd fd) } extern struct file *fget(unsigned int fd); +extern struct file *fget_many(unsigned int fd, unsigned int refs); extern struct file *fget_raw(unsigned int fd); extern unsigned long __fdget(unsigned int fd); extern unsigned long __fdget_raw(unsigned int fd); |