{
struct bio *bio = &device->flush_bio;
- device->last_flush_error = BLK_STS_OK;
+ clear_bit(BTRFS_DEV_STATE_FLUSH_FAILED, &device->dev_state);
bio_init(bio, device->bdev, NULL, 0,
REQ_OP_WRITE | REQ_SYNC | REQ_PREFLUSH);
wait_for_completion_io(&device->flush_wait);
if (bio->bi_status) {
- device->last_flush_error = bio->bi_status;
+ set_bit(BTRFS_DEV_STATE_FLUSH_FAILED, &device->dev_state);
btrfs_dev_stat_inc_and_print(device, BTRFS_DEV_STAT_FLUSH_ERRS);
return true;
}
}
/*
- * Checks last_flush_error of disks in order to determine the device
+ * Checks flush failure of disks in order to determine the device
* state.
*/
if (unlikely(errors_wait && !btrfs_check_rw_degradable(info, NULL)))
* any transaction and set the error state, guaranteeing no commits of
* unsafe super blocks.
*/
- device->last_flush_error = 0;
+ clear_bit(BTRFS_DEV_STATE_FLUSH_FAILED, &device->dev_state);
/* Verify the device is back in a pristine state */
WARN_ON(test_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state));
if (!dev || !dev->bdev ||
test_bit(BTRFS_DEV_STATE_MISSING, &dev->dev_state) ||
- dev->last_flush_error)
+ test_bit(BTRFS_DEV_STATE_FLUSH_FAILED, &dev->dev_state))
missing++;
else if (failing_dev && failing_dev == dev)
missing++;
#define BTRFS_DEV_STATE_REPLACE_TGT (3)
#define BTRFS_DEV_STATE_FLUSH_SENT (4)
#define BTRFS_DEV_STATE_NO_READA (5)
+#define BTRFS_DEV_STATE_FLUSH_FAILED (6)
/* Set when the device item is found in chunk tree, used to catch unexpected registered device. */
#define BTRFS_DEV_STATE_ITEM_FOUND (7)
struct btrfs_zoned_device_info *zone_info;
- /*
- * Device's major-minor number. Must be set even if the device is not
- * opened (bdev == NULL), unless the device is missing.
- */
- dev_t devt;
unsigned long dev_state;
- blk_status_t last_flush_error;
#ifdef __BTRFS_NEED_DEVICE_DATA_ORDERED
seqcount_t data_seqcount;
atomic_t dev_stats_ccnt;
atomic_t dev_stat_values[BTRFS_DEV_STAT_VALUES_MAX];
+ /*
+ * Device's major-minor number. Must be set even if the device is not
+ * opened (bdev == NULL), unless the device is missing.
+ */
+ dev_t devt;
+
struct extent_io_tree alloc_state;
struct completion kobj_unregister;