block: rename bio bi_rw to bi_opf

Since commit 63a4cc2486, bio->bi_rw contains flags in the lower
portion and the op code in the higher portions. This means that
old code that relies on manually setting bi_rw is most likely
going to be broken. Instead of letting that brokeness linger,
rename the member, to force old and out-of-tree code to break
at compile time instead of at runtime.

No intended functional changes in this commit.

Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
Jens Axboe 2016-08-05 15:35:16 -06:00
commit 1eff9d322a
51 changed files with 158 additions and 157 deletions

View file

@ -95,7 +95,7 @@ static inline bool bio_is_rw(struct bio *bio)
static inline bool bio_mergeable(struct bio *bio)
{
if (bio->bi_rw & REQ_NOMERGE_FLAGS)
if (bio->bi_opf & REQ_NOMERGE_FLAGS)
return false;
return true;
@ -318,7 +318,7 @@ struct bio_integrity_payload {
static inline struct bio_integrity_payload *bio_integrity(struct bio *bio)
{
if (bio->bi_rw & REQ_INTEGRITY)
if (bio->bi_opf & REQ_INTEGRITY)
return bio->bi_integrity;
return NULL;

View file

@ -714,9 +714,9 @@ static inline bool blkcg_bio_issue_check(struct request_queue *q,
if (!throtl) {
blkg = blkg ?: q->root_blkg;
blkg_rwstat_add(&blkg->stat_bytes, bio_op(bio), bio->bi_rw,
blkg_rwstat_add(&blkg->stat_bytes, bio_op(bio), bio->bi_opf,
bio->bi_iter.bi_size);
blkg_rwstat_add(&blkg->stat_ios, bio_op(bio), bio->bi_rw, 1);
blkg_rwstat_add(&blkg->stat_ios, bio_op(bio), bio->bi_opf, 1);
}
rcu_read_unlock();

View file

@ -27,8 +27,9 @@ struct bio {
struct bio *bi_next; /* request queue link */
struct block_device *bi_bdev;
int bi_error;
unsigned int bi_rw; /* bottom bits req flags,
* top bits REQ_OP
unsigned int bi_opf; /* bottom bits req flags,
* top bits REQ_OP. Use
* accessors.
*/
unsigned short bi_flags; /* status, command, etc */
unsigned short bi_ioprio;
@ -89,13 +90,13 @@ struct bio {
};
#define BIO_OP_SHIFT (8 * sizeof(unsigned int) - REQ_OP_BITS)
#define bio_op(bio) ((bio)->bi_rw >> BIO_OP_SHIFT)
#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_rw &= ((1 << BIO_OP_SHIFT) - 1); \
(bio)->bi_rw |= ((unsigned int) (op) << BIO_OP_SHIFT); \
(bio)->bi_rw |= op_flags; \
(bio)->bi_opf &= ((1 << BIO_OP_SHIFT) - 1); \
(bio)->bi_opf |= ((unsigned int) (op) << BIO_OP_SHIFT); \
(bio)->bi_opf |= op_flags; \
} while (0)
#define BIO_RESET_BYTES offsetof(struct bio, bi_max_vecs)
@ -138,7 +139,7 @@ struct bio {
/*
* Request flags. For use in the cmd_flags field of struct request, and in
* bi_rw of struct bio. Note that some flags are only valid in either one.
* bi_opf of struct bio. Note that some flags are only valid in either one.
*/
enum rq_flag_bits {
/* common flags */