btrfs: Remove redundant pair of bio_get/set in __btrfs_submit_dio_bio
authorNikolay Borisov <nborisov@suse.com>
Wed, 13 Dec 2017 08:25:40 +0000 (10:25 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 22 Jan 2018 15:08:19 +0000 (16:08 +0100)
The bio is not referenced after it has been submitted and the endio is
going to consume the sole reference on successful submission. On error,
the callers of __btrfs_submit_dio_bio do invoke bio_put so we don't
leak it either.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c

index bacf71ccf0f2944ad6c479f9161142df6d0702c2..0c0e61c6b9273564ce4eb2f84add8bf9c7864e51 100644 (file)
@@ -8449,8 +8449,6 @@ __btrfs_submit_dio_bio(struct bio *bio, struct inode *inode, u64 file_offset,
        if (async_submit)
                async_submit = !atomic_read(&BTRFS_I(inode)->sync_writers);
 
-       bio_get(bio);
-
        if (!write) {
                ret = btrfs_bio_wq_end_io(fs_info, bio, BTRFS_WQ_ENDIO_DATA);
                if (ret)
@@ -8483,7 +8481,6 @@ __btrfs_submit_dio_bio(struct bio *bio, struct inode *inode, u64 file_offset,
 map:
        ret = btrfs_map_bio(fs_info, bio, 0, 0);
 err:
-       bio_put(bio);
        return ret;
 }