Skip to content

Commit

Permalink
Btrfs: change wait_dev_flush() return type to bool
Browse files Browse the repository at this point in the history
The flush error code is maintained in btrfs_device::last_flush_error, so
there is no point in returning it in wait_dev_flush() when it is not being
used. Instead, we can return a boolean value.

Note that even though btrfs_device::last_flush_error may not be used, we
will keep it for now.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
  • Loading branch information
asj authored and intel-lab-lkp committed Mar 27, 2023
1 parent a112dad commit d26d540
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions fs/btrfs/disk-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -4110,23 +4110,25 @@ static void write_dev_flush(struct btrfs_device *device)

/*
* If the flush bio has been submitted by write_dev_flush, wait for it.
* Return false for any error, and true otherwise.
*/
static blk_status_t wait_dev_flush(struct btrfs_device *device)
static bool wait_dev_flush(struct btrfs_device *device)
{
struct bio *bio = &device->flush_bio;

if (!test_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state))
return BLK_STS_OK;
return true;

clear_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state);
wait_for_completion_io(&device->flush_wait);

if (bio->bi_status) {
device->last_flush_error = bio->bi_status;
btrfs_dev_stat_inc_and_print(device, BTRFS_DEV_STAT_FLUSH_ERRS);
return false;
}

return bio->bi_status;
return true;
}

/*
Expand Down

0 comments on commit d26d540

Please sign in to comment.