Skip to content

Commit

Permalink
block: clear all of bi_opf in bio_set_op_attrs
Browse files Browse the repository at this point in the history
Since commit 8737417 ("block: add a proper block layer data direction
encoding") we only or the new op and flags into bi_opf in bio_set_op_attrs
instead of clearing the old value.  I've not seen any breakage with the
new behavior, but it seems dangerous.

Also convert it to an inline function to make the argument passing
safer.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
  • Loading branch information
Christoph Hellwig authored and Jens Axboe committed Nov 21, 2016
1 parent 5a8b187 commit 93c5bdf
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions include/linux/blk_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,11 @@ enum req_flag_bits {
((req)->cmd_flags & REQ_OP_MASK)

/* obsolete, don't use in new code */
#define bio_set_op_attrs(bio, op, op_flags) \
((bio)->bi_opf |= (op | op_flags))
static inline void bio_set_op_attrs(struct bio *bio, unsigned op,
unsigned op_flags)
{
bio->bi_opf = op | op_flags;
}

static inline bool op_is_write(unsigned int op)
{
Expand Down

0 comments on commit 93c5bdf

Please sign in to comment.