]> git.karo-electronics.de Git - linux-beck.git/commitdiff
block, dm-crypt, btrfs: Introduce bio_flags()
authorBart Van Assche <bart.vanassche@sandisk.com>
Wed, 14 Sep 2016 08:45:36 +0000 (10:45 +0200)
committerJens Axboe <axboe@fb.com>
Wed, 14 Sep 2016 14:48:27 +0000 (08:48 -0600)
Introduce the bio_flags() macro. Ensure that the second argument of
bio_set_op_attrs() only contains flags and no operation. This patch
does not change any functionality.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Chris Mason <clm@fb.com> (maintainer:BTRFS FILE SYSTEM)
Cc: Josef Bacik <jbacik@fb.com> (maintainer:BTRFS FILE SYSTEM)
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Damien Le Moal <damien.lemoal@hgst.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/md/dm-crypt.c
fs/btrfs/inode.c
include/linux/blk_types.h

index eedba67b0e3ef6bed544b959d8440a5433c6bc75..9ba0f0724d28fea0821b871dd62de5ec65868b7f 100644 (file)
@@ -1136,7 +1136,7 @@ static void clone_init(struct dm_crypt_io *io, struct bio *clone)
        clone->bi_private = io;
        clone->bi_end_io  = crypt_endio;
        clone->bi_bdev    = cc->dev->bdev;
-       bio_set_op_attrs(clone, bio_op(io->base_bio), io->base_bio->bi_opf);
+       bio_set_op_attrs(clone, bio_op(io->base_bio), bio_flags(io->base_bio));
 }
 
 static int kcryptd_io_read(struct dm_crypt_io *io, gfp_t gfp)
index e6811c42e41ef34d27119ee5420d4c6653df8519..ca01106795ead9c753260c8bb67f12b390844607 100644 (file)
@@ -8412,7 +8412,7 @@ static int btrfs_submit_direct_hook(struct btrfs_dio_private *dip,
        if (!bio)
                return -ENOMEM;
 
-       bio_set_op_attrs(bio, bio_op(orig_bio), orig_bio->bi_opf);
+       bio_set_op_attrs(bio, bio_op(orig_bio), bio_flags(orig_bio));
        bio->bi_private = dip;
        bio->bi_end_io = btrfs_end_dio_bio;
        btrfs_io_bio(bio)->logical = file_offset;
@@ -8450,7 +8450,8 @@ next_block:
                                                  start_sector, GFP_NOFS);
                        if (!bio)
                                goto out_err;
-                       bio_set_op_attrs(bio, bio_op(orig_bio), orig_bio->bi_opf);
+                       bio_set_op_attrs(bio, bio_op(orig_bio),
+                                        bio_flags(orig_bio));
                        bio->bi_private = dip;
                        bio->bi_end_io = btrfs_end_dio_bio;
                        btrfs_io_bio(bio)->logical = file_offset;
index 1e1ef210ae91b0af43aa6825ea35e7e0eac9974f..311fa2f478b8439960a65602d710594c94153cf4 100644 (file)
@@ -90,11 +90,12 @@ struct bio {
 };
 
 #define BIO_OP_SHIFT   (8 * FIELD_SIZEOF(struct bio, bi_opf) - REQ_OP_BITS)
+#define bio_flags(bio) ((bio)->bi_opf & ((1 << BIO_OP_SHIFT) - 1))
 #define bio_op(bio)    ((bio)->bi_opf >> BIO_OP_SHIFT)
 
 #define bio_set_op_attrs(bio, op, op_flags) do {               \
        WARN_ON(op >= (1 << REQ_OP_BITS));                      \
-       (bio)->bi_opf &= ((1 << BIO_OP_SHIFT) - 1);             \
+       (bio)->bi_opf = bio_flags(bio);                         \
        (bio)->bi_opf |= ((unsigned int) (op) << BIO_OP_SHIFT); \
        (bio)->bi_opf |= op_flags;                              \
 } while (0)