mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-23 13:49:28 +07:00
Btrfs: Hold a reference on bios during submit_bio, add some extra bio checks
Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
parent
3ce7e67a06
commit
492bb6deee
@ -180,7 +180,11 @@ int run_scheduled_bios(struct btrfs_device *device)
|
|||||||
pending = pending->bi_next;
|
pending = pending->bi_next;
|
||||||
cur->bi_next = NULL;
|
cur->bi_next = NULL;
|
||||||
atomic_dec(&device->dev_root->fs_info->nr_async_submits);
|
atomic_dec(&device->dev_root->fs_info->nr_async_submits);
|
||||||
|
|
||||||
|
BUG_ON(atomic_read(&cur->bi_cnt) == 0);
|
||||||
|
bio_get(cur);
|
||||||
submit_bio(cur->bi_rw, cur);
|
submit_bio(cur->bi_rw, cur);
|
||||||
|
bio_put(cur);
|
||||||
num_run++;
|
num_run++;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -188,10 +192,11 @@ int run_scheduled_bios(struct btrfs_device *device)
|
|||||||
* is now congested. Back off and let other work structs
|
* is now congested. Back off and let other work structs
|
||||||
* run instead
|
* run instead
|
||||||
*/
|
*/
|
||||||
if (pending && num_run && bdi_write_congested(bdi)) {
|
if (pending && bdi_write_congested(bdi)) {
|
||||||
struct bio *old_head;
|
struct bio *old_head;
|
||||||
|
|
||||||
spin_lock(&device->io_lock);
|
spin_lock(&device->io_lock);
|
||||||
|
|
||||||
old_head = device->pending_bios;
|
old_head = device->pending_bios;
|
||||||
device->pending_bios = pending;
|
device->pending_bios = pending;
|
||||||
if (device->pending_bio_tail)
|
if (device->pending_bio_tail)
|
||||||
@ -2125,7 +2130,9 @@ int schedule_bio(struct btrfs_root *root, struct btrfs_device *device,
|
|||||||
|
|
||||||
/* don't bother with additional async steps for reads, right now */
|
/* don't bother with additional async steps for reads, right now */
|
||||||
if (!(rw & (1 << BIO_RW))) {
|
if (!(rw & (1 << BIO_RW))) {
|
||||||
|
bio_get(bio);
|
||||||
submit_bio(rw, bio);
|
submit_bio(rw, bio);
|
||||||
|
bio_put(bio);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2136,6 +2143,7 @@ int schedule_bio(struct btrfs_root *root, struct btrfs_device *device,
|
|||||||
* on a queue for later
|
* on a queue for later
|
||||||
*/
|
*/
|
||||||
atomic_inc(&root->fs_info->nr_async_submits);
|
atomic_inc(&root->fs_info->nr_async_submits);
|
||||||
|
WARN_ON(bio->bi_next);
|
||||||
bio->bi_next = NULL;
|
bio->bi_next = NULL;
|
||||||
bio->bi_rw |= rw;
|
bio->bi_rw |= rw;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user