Re: [EXT] Re: [PATCH 2/2] block: remove the per-bio/request write hint.

Bart Van Assche
2022-03-10T22:18:28Z

On 3/10/22 13:52, Bean Huo (beanhuo) wrote:
> Yes, in upstream linux and upstream android, there is no such code. But as we know,
> mobile customers have used bio->bi_write_hint in their products for years. And the
> group ID is set according to bio->bi_write_hint before passing the CDB to UFS.
>
>
> lrbp = &hba->lrb[tag];
>
> WARN_ON(lrbp->cmd);
> + if(cmd->cmnd[0] == WRITE_10)
> +{
> + cmd->cmnd[6] = (0x1f& cmd->request->bio->bi_write_hint);
> +}
> lrbp->cmd = cmd;
> lrbp->sense_bufflen = UFS_SENSE_SIZE;
> lrbp->sense_buffer = cmd->sense_buffer;
>
> I don't know why they don't push these changes to the community, maybe
> it's because changes across the file system and block layers are unacceptable to the
> block layer and FS. but for sure we should now warn them to push to the
> community as soon as possible.

Thanks Bean for having shared this information. I think the above code sets the GROUP
NUMBER information in the WRITE(10) command and also that the following text from the
UFS specification applies to that information:
<quote>
GROUP NUMBER: Notifies the Target device that the data linked to a ContextID:
-----------------------------------------------------------------------------------------
GROUP NUMBER Value | Function
-----------------------------------------------------------------------------------------
00000b | Default, no Context ID is associated with the read operation.
00001b to 01111b (0XXXXb) | Context ID. (XXXX I from 0001b to 1111b ‐ Context ID value)
10000b | Data has System Data characteristics
10001b to 11111b | Reserved
-----------------------------------------------------------------------------------------

In case the GROUP NUMBER is set to a reserved value, the operation shall fail and a status
response of CHECK CONDITION will be returned along with the sense key set to ILLEGAL REQUEST.
</quote>

Since there is a desire to remove the write hint information from struct bio, is there
any other information the "system data characteristics" information can be derived from?
How about e.g. deriving that information from request flags like REQ_SYNC, REQ_META and/or
REQ_IDLE?

Thanks,

Bart.