mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 08:14:15 +08:00
btrfs: switch search_file_offset_in_bio to return bool
Function search_file_offset_in_bio() finds the file offset in the file_offset_ret, and we use the return value to indicate if it is successful, so use bool. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Anand Jain <anand.jain@oracle.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
da8269a3e9
commit
19337f8ea3
@ -345,8 +345,8 @@ out:
|
|||||||
*
|
*
|
||||||
* @inode is used to determine if the bvec page really belongs to @inode.
|
* @inode is used to determine if the bvec page really belongs to @inode.
|
||||||
*
|
*
|
||||||
* Return 0 if we can't find the file offset
|
* Return false if we can't find the file offset
|
||||||
* Return >0 if we find the file offset and restore it to @file_offset_ret
|
* Return true if we find the file offset and restore it to @file_offset_ret
|
||||||
*/
|
*/
|
||||||
static int search_file_offset_in_bio(struct bio *bio, struct inode *inode,
|
static int search_file_offset_in_bio(struct bio *bio, struct inode *inode,
|
||||||
u64 disk_bytenr, u64 *file_offset_ret)
|
u64 disk_bytenr, u64 *file_offset_ret)
|
||||||
@ -354,7 +354,7 @@ static int search_file_offset_in_bio(struct bio *bio, struct inode *inode,
|
|||||||
struct bvec_iter iter;
|
struct bvec_iter iter;
|
||||||
struct bio_vec bvec;
|
struct bio_vec bvec;
|
||||||
u64 cur = bio->bi_iter.bi_sector << SECTOR_SHIFT;
|
u64 cur = bio->bi_iter.bi_sector << SECTOR_SHIFT;
|
||||||
int ret = 0;
|
bool ret = false;
|
||||||
|
|
||||||
bio_for_each_segment(bvec, bio, iter) {
|
bio_for_each_segment(bvec, bio, iter) {
|
||||||
struct page *page = bvec.bv_page;
|
struct page *page = bvec.bv_page;
|
||||||
@ -368,7 +368,7 @@ static int search_file_offset_in_bio(struct bio *bio, struct inode *inode,
|
|||||||
ASSERT(in_range(disk_bytenr, cur, bvec.bv_len));
|
ASSERT(in_range(disk_bytenr, cur, bvec.bv_len));
|
||||||
if (page->mapping && page->mapping->host &&
|
if (page->mapping && page->mapping->host &&
|
||||||
page->mapping->host == inode) {
|
page->mapping->host == inode) {
|
||||||
ret = 1;
|
ret = true;
|
||||||
*file_offset_ret = page_offset(page) + bvec.bv_offset +
|
*file_offset_ret = page_offset(page) + bvec.bv_offset +
|
||||||
disk_bytenr - cur;
|
disk_bytenr - cur;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user