aboutsummaryrefslogtreecommitdiff
path: root/drivers/md/dm-zero.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2016-07-19 11:28:41 +0200
committerJens Axboe <axboe@fb.com>2016-07-20 17:37:01 -0600
commit70246286e94c335b5bea0cbc68a17a96dd620281 (patch)
tree6333c1ba1ce00b3a3a2254acc34db552ae9c4159 /drivers/md/dm-zero.c
parent3f40bf2c89223192535a72a4d49ce7d68d8ed9dd (diff)
block: get rid of bio_rw and READA
These two are confusing leftover of the old world order, combining values of the REQ_OP_ and REQ_ namespaces. For callers that don't special case we mostly just replace bi_rw with bio_data_dir or op_is_write, except for the few cases where a switch over the REQ_OP_ values makes more sense. Any check for READA is replaced with an explicit check for REQ_RAHEAD. Also remove the READA alias for REQ_RAHEAD. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Mike Christie <mchristi@redhat.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/md/dm-zero.c')
-rw-r--r--drivers/md/dm-zero.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/md/dm-zero.c b/drivers/md/dm-zero.c
index 766bc93006e6..618b8752dcf1 100644
--- a/drivers/md/dm-zero.c
+++ b/drivers/md/dm-zero.c
@@ -35,16 +35,19 @@ static int zero_ctr(struct dm_target *ti, unsigned int argc, char **argv)
*/
static int zero_map(struct dm_target *ti, struct bio *bio)
{
- switch(bio_rw(bio)) {
- case READ:
+ switch (bio_op(bio)) {
+ case REQ_OP_READ:
+ if (bio->bi_rw & REQ_RAHEAD) {
+ /* readahead of null bytes only wastes buffer cache */
+ return -EIO;
+ }
zero_fill_bio(bio);
break;
- case READA:
- /* readahead of null bytes only wastes buffer cache */
- return -EIO;
- case WRITE:
+ case REQ_OP_WRITE:
/* writes get silently dropped */
break;
+ default:
+ return -EIO;
}
bio_endio(bio);