[dm-devel] [PATCH 1/5] btrfs: simplify ->flush_bio handling

David Sterba dsterba at suse.cz
Tue Mar 1 14:22:09 UTC 2022


On Tue, Mar 01, 2022 at 10:45:48AM +0200, Christoph Hellwig wrote:
> @@ -6962,16 +6961,6 @@ struct btrfs_device *btrfs_alloc_device(struct btrfs_fs_info *fs_info,
>  	if (!dev)
>  		return ERR_PTR(-ENOMEM);
>  
> -	/*
> -	 * Preallocate a bio that's always going to be used for flushing device
> -	 * barriers and matches the device lifespan
> -	 */
> -	dev->flush_bio = bio_kmalloc(GFP_KERNEL, 0);
> -	if (!dev->flush_bio) {
> -		kfree(dev);
> -		return ERR_PTR(-ENOMEM);
> -	}
> -
>  	INIT_LIST_HEAD(&dev->dev_list);
>  	INIT_LIST_HEAD(&dev->dev_alloc_list);
>  	INIT_LIST_HEAD(&dev->post_commit_list);
> diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
> index 005c9e2a491a1..9af7b6211920c 100644
> --- a/fs/btrfs/volumes.h
> +++ b/fs/btrfs/volumes.h
> @@ -117,7 +117,7 @@ struct btrfs_device {
>  	u64 commit_bytes_used;
>  
>  	/* for sending down flush barriers */
> -	struct bio *flush_bio;

Please add this comment to the struct member declaration:

	/* Bio used for flushing device barriers */

> +	struct bio flush_bio;

Otherwise

Reviewed-by: David Sterba <dsterba at suse.com>

Thanks.




More information about the dm-devel mailing list