block: better op and flags encoding

Now that we don't need the common flags to overflow outside the range
of a 32-bit type we can encode them the same way for both the bio and
request fields.  This in addition allows us to place the operation
first (and make some room for more ops while we're at it) and to
stop having to shift around the operation values.

In addition this allows passing around only one value in the block layer
instead of two (and eventuall also in the file systems, but we can do
that later) and thus clean up a lot of code.

Last but not least this allows decreasing the size of the cmd_flags
field in struct request to 32-bits.  Various functions passing this
value could also be updated, but I'd like to avoid the churn for now.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
Šī revīzija ir iekļauta:
Christoph Hellwig
2016-10-28 08:48:16 -06:00
revīziju iesūtīja Jens Axboe
vecāks e806402130
revīzija ef295ecf09
23 mainīti faili ar 148 papildinājumiem un 221 dzēšanām

Parādīt failu

@@ -8427,7 +8427,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), bio_flags(orig_bio));
bio->bi_opf = orig_bio->bi_opf;
bio->bi_private = dip;
bio->bi_end_io = btrfs_end_dio_bio;
btrfs_io_bio(bio)->logical = file_offset;
@@ -8465,8 +8465,7 @@ next_block:
start_sector, GFP_NOFS);
if (!bio)
goto out_err;
bio_set_op_attrs(bio, bio_op(orig_bio),
bio_flags(orig_bio));
bio->bi_opf = orig_bio->bi_opf;
bio->bi_private = dip;
bio->bi_end_io = btrfs_end_dio_bio;
btrfs_io_bio(bio)->logical = file_offset;