Re: [PATCH 03/22] scsi: add scsi_{get,put}_internal_cmd() helper

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

 



On 02/07/2020 09:21, Johannes Thumshirn wrote:
On 02/07/2020 09:59, Hannes Reinecke wrote:
That's one of the best-kept secrets in the block layer:

op_is_write()

The assumption is that every request with a REQ_OP which has the lowest
bit set is a write.
And quite a lot of accounting the the block layer revolves around that.
So we'll need to keep it.

... and we probably should document it somewhere.


Now that I check further, it is documented in blk_types.h:

 * The least significant bit of the operation number indicates the data
 * transfer direction:
 *
 *   - if the least significant bit is set transfers are TO the device
* - if the least significant bit is not set transfers are FROM the device
 *

I personally find this very obvious:

static inline bool op_is_write(unsigned int op) > {
	return (op & 1);
}

.





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux