Re: [PATCH] block: remove redundant req_op in blk_rq_is_passthrough

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/22/23 01:53, linan666@xxxxxxxxxxxxxxx wrote:
> From: Li Nan <linan122@xxxxxxxxxx>
>
> op &= REQ_OP_MASK in blk_op_is_passthrough() is exactly what req_op() do.
> Therefore, it is redundant to call req_op() for blk_op_is_passthrough().

I couldn't understand commit log, feel free to ignore following
if others are okay with it :-

req_op() returns the REQ_OP_XXX with req->cmd_flags & REQ_OP_MASKS.

blk_op_is_passthrugh() masks op with REQ_OP_MASKS to compare
REQ_OP_XXX with passthrough requests REQ_OP_IN/REQ_OP_OUT.
  245
  246 static inline bool blk_op_is_passthrough(blk_opf_t op)
  247 {
  248         op &= REQ_OP_MASK;
  249         return op == REQ_OP_DRV_IN || op == REQ_OP_DRV_OUT;
  250 }
  251

Passing req_op(rq) argument to blk_op_is_passthru() results in double
masking of request flags first in req_op() and again in
blk_op_is_passthrough().

Avoid that by passing req->cmd_flags instead of req_op(req) as
an argument to blk_op_is_passthrough() when it is called from
blk_rq_is_passthruough().


irrespective of above suggestion, looks good.

Reviewed-by: Chaitanya Kulkarni <kch@xxxxxxxxxx>

-ck






[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux