@@ -501,7 +501,7 @@ static int xen_vbd_translate(struct phys_req *req, struct xen_blkif *blkif,
501501 struct xen_vbd * vbd = & blkif -> vbd ;
502502 int rc = - EACCES ;
503503
504- if ((operation != READ ) && vbd -> readonly )
504+ if ((operation != REQ_OP_READ ) && vbd -> readonly )
505505 goto out ;
506506
507507 if (likely (req -> nr_sects )) {
@@ -1014,7 +1014,7 @@ static int dispatch_discard_io(struct xen_blkif_ring *ring,
10141014 preq .sector_number = req -> u .discard .sector_number ;
10151015 preq .nr_sects = req -> u .discard .nr_sectors ;
10161016
1017- err = xen_vbd_translate (& preq , blkif , WRITE );
1017+ err = xen_vbd_translate (& preq , blkif , REQ_OP_WRITE );
10181018 if (err ) {
10191019 pr_warn ("access denied: DISCARD [%llu->%llu] on dev=%04x\n" ,
10201020 preq .sector_number ,
@@ -1229,6 +1229,7 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring,
12291229 struct bio * * biolist = pending_req -> biolist ;
12301230 int i , nbio = 0 ;
12311231 int operation ;
1232+ int operation_flags = 0 ;
12321233 struct blk_plug plug ;
12331234 bool drain = false;
12341235 struct grant_page * * pages = pending_req -> segments ;
@@ -1247,17 +1248,19 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring,
12471248 switch (req_operation ) {
12481249 case BLKIF_OP_READ :
12491250 ring -> st_rd_req ++ ;
1250- operation = READ ;
1251+ operation = REQ_OP_READ ;
12511252 break ;
12521253 case BLKIF_OP_WRITE :
12531254 ring -> st_wr_req ++ ;
1254- operation = WRITE_ODIRECT ;
1255+ operation = REQ_OP_WRITE ;
1256+ operation_flags = WRITE_ODIRECT ;
12551257 break ;
12561258 case BLKIF_OP_WRITE_BARRIER :
12571259 drain = true;
12581260 case BLKIF_OP_FLUSH_DISKCACHE :
12591261 ring -> st_f_req ++ ;
1260- operation = WRITE_FLUSH ;
1262+ operation = REQ_OP_WRITE ;
1263+ operation_flags = WRITE_FLUSH ;
12611264 break ;
12621265 default :
12631266 operation = 0 ; /* make gcc happy */
@@ -1269,7 +1272,7 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring,
12691272 nseg = req -> operation == BLKIF_OP_INDIRECT ?
12701273 req -> u .indirect .nr_segments : req -> u .rw .nr_segments ;
12711274
1272- if (unlikely (nseg == 0 && operation != WRITE_FLUSH ) ||
1275+ if (unlikely (nseg == 0 && operation_flags != WRITE_FLUSH ) ||
12731276 unlikely ((req -> operation != BLKIF_OP_INDIRECT ) &&
12741277 (nseg > BLKIF_MAX_SEGMENTS_PER_REQUEST )) ||
12751278 unlikely ((req -> operation == BLKIF_OP_INDIRECT ) &&
@@ -1310,7 +1313,7 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring,
13101313
13111314 if (xen_vbd_translate (& preq , ring -> blkif , operation ) != 0 ) {
13121315 pr_debug ("access denied: %s of [%llu,%llu] on dev=%04x\n" ,
1313- operation == READ ? "read" : "write" ,
1316+ operation == REQ_OP_READ ? "read" : "write" ,
13141317 preq .sector_number ,
13151318 preq .sector_number + preq .nr_sects ,
13161319 ring -> blkif -> vbd .pdevice );
@@ -1369,15 +1372,15 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring,
13691372 bio -> bi_private = pending_req ;
13701373 bio -> bi_end_io = end_block_io_op ;
13711374 bio -> bi_iter .bi_sector = preq .sector_number ;
1372- bio -> bi_rw = operation ;
1375+ bio_set_op_attrs ( bio , operation , operation_flags ) ;
13731376 }
13741377
13751378 preq .sector_number += seg [i ].nsec ;
13761379 }
13771380
13781381 /* This will be hit if the operation was a flush or discard. */
13791382 if (!bio ) {
1380- BUG_ON (operation != WRITE_FLUSH );
1383+ BUG_ON (operation_flags != WRITE_FLUSH );
13811384
13821385 bio = bio_alloc (GFP_KERNEL , 0 );
13831386 if (unlikely (bio == NULL ))
@@ -1387,7 +1390,7 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring,
13871390 bio -> bi_bdev = preq .bdev ;
13881391 bio -> bi_private = pending_req ;
13891392 bio -> bi_end_io = end_block_io_op ;
1390- bio -> bi_rw = operation ;
1393+ bio_set_op_attrs ( bio , operation , operation_flags ) ;
13911394 }
13921395
13931396 atomic_set (& pending_req -> pendcnt , nbio );
@@ -1399,9 +1402,9 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring,
13991402 /* Let the I/Os go.. */
14001403 blk_finish_plug (& plug );
14011404
1402- if (operation == READ )
1405+ if (operation == REQ_OP_READ )
14031406 ring -> st_rd_sect += preq .nr_sects ;
1404- else if (operation & WRITE )
1407+ else if (operation == REQ_OP_WRITE )
14051408 ring -> st_wr_sect += preq .nr_sects ;
14061409
14071410 return 0 ;
0 commit comments