]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit - fs/file_table.c
fs: add fget_many() and fput_many()
authorJens Axboe <axboe@kernel.dk>
Wed, 21 Nov 2018 17:32:39 +0000 (10:32 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 28 Feb 2019 15:24:23 +0000 (08:24 -0700)
commit091141a42e15fe47ada737f3996b317072afcefb
treed7a89e516c2e1064841dfa938cf043b5c4572675
parentdef596e9557c91d9846fc4d84d26f2c564644416
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>
fs/file.c
fs/file_table.c
include/linux/file.h
include/linux/fs.h