aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.h
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2017-06-06 17:06:06 +0200
committerDavid Sterba <dsterba@suse.com>2017-06-21 19:03:38 +0200
commite0ae999414238aa9c0a116844813982effb68a02 (patch)
treeb127434d66d6eea75a6132b3e5b8176c2608e9d9 /fs/btrfs/volumes.h
parentBtrfs: incremental send, fix invalid path for unlink commands (diff)
downloadlinux-dev-e0ae999414238aa9c0a116844813982effb68a02.tar.xz
linux-dev-e0ae999414238aa9c0a116844813982effb68a02.zip
btrfs: preallocate device flush bio
For devices that support flushing, we allocate a bio, submit, wait for it and then free it. The bio allocation does not fail so ENOMEM is not a problem but we still may unnecessarily stress the allocation subsystem. Instead, we can allocate the bio at the same time we allocate the device and reuse it each time we need to flush the barriers. The bio is reset before each use. Reference counting is simplified to just device allocation (get) and freeing (put). The bio used to be submitted through the integrity checker which will find out that bio has no data attached and call submit_bio. Status of the bio in flight needs to be tracked separately in case the device caches get switched off between write and wait. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/volumes.h')
-rw-r--r--fs/btrfs/volumes.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index 35327efecdbb..6f45fd60d15a 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -75,6 +75,7 @@ struct btrfs_device {
int can_discard;
int is_tgtdev_for_dev_replace;
int last_flush_error;
+ int flush_bio_sent;
#ifdef __BTRFS_NEED_DEVICE_DATA_ORDERED
seqcount_t data_seqcount;