Re: [RFC PATCH 5/5] scsi: ufs: Prepare HPB read for cached sub-region

2020-06-11 Thread Daejun Park
On 2020-06-04 18:38, Daejun Park wrote: > > + if (total_srgn_cnt != 0) { > > +dev_err(hba->dev, "ufshpb(%d) error total_subregion_count %d", > > + hpb->lun, total_srgn_cnt); > > +goto release_srgn_table; > > + } > > + > > + return 0; > > +release_srgn_table: > > + for (i = 0; i <

RE: [RFC PATCH 5/5] scsi: ufs: Prepare HPB read for cached sub-region

2020-06-11 Thread Avri Altman
> > +static inline bool ufshpb_is_support_chunk(int transfer_len) > > +{ > > + return transfer_len <= HPB_MULTI_CHUNK_HIGH; > > +} > > The names used in the above function are mysterious. What is a support > chunk? What does "multi chunk high" mean? Please add a comment. HPB1.0 limits

Re: [RFC PATCH 5/5] scsi: ufs: Prepare HPB read for cached sub-region

2020-06-10 Thread Bart Van Assche
On 2020-06-04 19:12, Daejun Park wrote: > +static inline bool ufshpb_is_read_cmd(struct scsi_cmnd *cmd) > +{ > + if (cmd->cmnd[0] == READ_10 || cmd->cmnd[0] == READ_16) > + return true; > + > + return false; > +} Has it been considered to check req_op(cmd->request) instead of

Re: [RFC PATCH 5/5] scsi: ufs: Prepare HPB read for cached sub-region

2020-06-08 Thread Bart Van Assche
On 2020-06-06 11:38, Avri Altman wrote: >> + for (i = 0; i < bit_len; i++) { >> + if (test_bit(srgn_offset + i, srgn->mctx->ppn_dirty)) > > Maybe use a mask or hweight instead of testing bit by bit? How about using find_next_bit() from include/linux/bitmap.h? /* *

RE: [RFC PATCH 5/5] scsi: ufs: Prepare HPB read for cached sub-region

2020-06-08 Thread Daejun Park
> > +static bool ufshpb_test_ppn_dirty(struct ufshpb_lu *hpb, int rgn_idx, > > + int srgn_idx, int srgn_offset, int cnt) > > + > > + for (i = 0; i < bit_len; i++) { > > + if (test_bit(srgn_offset + i, srgn->mctx->ppn_dirty)) > Maybe use a mask

RE: [RFC PATCH 5/5] scsi: ufs: Prepare HPB read for cached sub-region

2020-06-06 Thread Avri Altman
> +static bool ufshpb_test_ppn_dirty(struct ufshpb_lu *hpb, int rgn_idx, > + int srgn_idx, int srgn_offset, int cnt) > + > + for (i = 0; i < bit_len; i++) { > + if (test_bit(srgn_offset + i, srgn->mctx->ppn_dirty)) Maybe use a mask or hweight