]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
fs: add fget_many() and fput_many()
authorJens Axboe <axboe@kernel.dk>
Wed, 21 Nov 2018 17:32:39 +0000 (10:32 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 Dec 2021 07:50:13 +0000 (08:50 +0100)
commit895538f9d351d3152248708a112143d4917f5a0b
treeff8d54201544f6c24f0f39b2627e9a328a874002
parent4f9a4d5708b5ef3de0fbf002aac97fbbf84f0226
fs: add fget_many() and fput_many()

commit 091141a42e15fe47ada737f3996b317072afcefb upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/file.c
fs/file_table.c
include/linux/file.h
include/linux/fs.h