mmc: block: Add single read for 4k sector cards
Quoted 6 lines
Cards with 4k native sector size may only be read 4k-aligned,
Quoted 1 line
accommodate for this in the single read recovery and use it.
Thanks for the patch.
Quoted 1 line
Quoted 6 lines
Quoted 2 lines
Fixes 81196976ed946 (mmc: block: Add blk-mq support)Signed-off-by Christian Loehle <[email protected]>FYI checkpatch says:
WARNING: From:/Signed-off-by: email name mismatch: 'From: "Christian Löhle" <[email protected]>' != 'Signed-off-by: Christian Loehle <[email protected]>'
Will be fixed in my future patches, thanks for the hint.
Quoted 21 lines
Quoted 21 lines
--- drivers/mmc/core/block.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-)drivers/mmc/core/block.c +1
-1@@ -176,7 +176,7 @@ static inline int mmc_blk_part_switch(struct mmc_card *card, unsigned int part_type);static void mmc_blk_rw_rq_prep (struct mmc_queue_req *mqrq,struct mmc_card *card, -int disable_multi, +int recovery_mode,struct mmc_queue *mq);static void mmc_blk_hsq_req_done (struct mmc_request *mrq);@@ -1302,7 +1302,7 @@ static void mmc_blk_eval_resp_error(struct mmc_blk_request *brq) }
Quoted 16 lines
Quoted 7 lines
drivers/mmc/core/block.c +1
-1static void mmc_blk_data_prep (struct mmc_queue *mq,struct mmc_queue_req *mqrq, -int disable_multi,bool *do_rel_wr_p, +int recovery_mode,bool *do_rel_wr_p,bool *do_data_tag_p) {struct mmc_blk_data *md = mq->blkdata;drivers/mmc/core/block.c static void mmc_blk_data_prep(struct mmc_queue *mq, struct mmc_queue_req *mqrq, · line 1376
Quoted 7 lines
drivers/mmc/core/block.c +2
-2@@ -1372,8 +1372,8 @@ static void mmc_blk_data_prep(struct mmc_queue *mq, struct mmc_queue_req *mqrq,* at a time in order to accurately determine which * sectors can be read successfully. */ -if (disable_multi) - brq->data.blocks =1 ; +if (recovery_mode) + brq->data.blocks =mmc_large_sector (card) ?8 :1 ;I suggest changing to use
queue_physical_block_size()here and further below
This part I'm impartial about, not sure if it makes it more readable, hopefully we never have to support another "native sector size" apart from the two. Anyway I will send the next patch with queue_physical_block_size()
Quoted 2 lines
brq->data.blocks = queue_physical_block_size(req->q) >> SECTOR_SHIFT;
Do we want to switch to SECTOR_SHIFT instead of 9? So far SECTOR_SHIFT is not used at all in mmc core. If so I would go ahead and change all the others in another patch:
queue.c:187: q->limits.discard_granularity = card->pref_erase << 9;
core.c:103: data->bytes_xfered = (prandom_u32() % (data->bytes_xfered >> 9)) << 9;
mmc.c:792:MMC_DEV_ATTR(erase_size, "%u\n", card->erase_size << 9); mmc.c:793:MMC_DEV_ATTR(preferred_erase_size, "%u\n", card->pref_erase << 9);
mmc_test.c:1557: sz = (unsigned long)test->card->pref_erase << 9;
mmc_test.c:1570: t->max_tfr = test->card->host->max_blk_count << 9;
mmc_test.c:2461: if (repeat_cmd && (t->blocks + 1) << 9 > t->max_tfr)
sd.c:707:MMC_DEV_ATTR(erase_size, "%u\n", card->erase_size << 9); sd.c:708:MMC_DEV_ATTR(preferred_erase_size, "%u\n", card->pref_erase << 9);
block.c:1417: int i, data_size = brq->data.blocks << 9;
block.c:1851: brq->data.bytes_xfered = blocks << 9;
Hyperstone GmbH | Reichenaustr. 39a | 78467 Konstanz Managing Director: Dr. Jan Peter Berns. Commercial register of local courts: Freiburg HRB381782
Quoted 53 lines · Christian Löhle
Quoted 6 lines
Cards with 4k native sector size may only be read 4k-aligned,
Quoted 1 line
accommodate for this in the single read recovery and use it.
Thanks for the patch.
Quoted 1 line
Quoted 6 lines
Quoted 2 lines
Fixes 81196976ed946 (mmc: block: Add blk-mq support)Signed-off-by Christian Loehle <[email protected]>FYI checkpatch says:
WARNING: From:/Signed-off-by: email name mismatch: 'From: "Christian Löhle" <[email protected]>' != 'Signed-off-by: Christian Loehle <[email protected]>'
Will be fixed in my future patches, thanks for the hint.
Quoted 21 lines
Quoted 21 lines
--- drivers/mmc/core/block.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-)drivers/mmc/core/block.c +1
-1@@ -176,7 +176,7 @@ static inline int mmc_blk_part_switch(struct mmc_card *card, unsigned int part_type);static void mmc_blk_rw_rq_prep (struct mmc_queue_req *mqrq,struct mmc_card *card, -int disable_multi, +int recovery_mode,struct mmc_queue *mq);static void mmc_blk_hsq_req_done (struct mmc_request *mrq);@@ -1302,7 +1302,7 @@ static void mmc_blk_eval_resp_error(struct mmc_blk_request *brq) }Quoted 16 lines
Quoted 7 lines
drivers/mmc/core/block.c +1
-1static void mmc_blk_data_prep (struct mmc_queue *mq,struct mmc_queue_req *mqrq, -int disable_multi,bool *do_rel_wr_p, +int recovery_mode,bool *do_rel_wr_p,bool *do_data_tag_p) {struct mmc_blk_data *md = mq->blkdata;drivers/mmc/core/block.c static void mmc_blk_data_prep(struct mmc_queue *mq, struct mmc_queue_req *mqrq, · line 1376
Quoted 7 lines
drivers/mmc/core/block.c +2
-2@@ -1372,8 +1372,8 @@ static void mmc_blk_data_prep(struct mmc_queue *mq, struct mmc_queue_req *mqrq,* at a time in order to accurately determine which * sectors can be read successfully. */ -if (disable_multi) - brq->data.blocks =1 ; +if (recovery_mode) + brq->data.blocks =mmc_large_sector (card) ?8 :1 ;I suggest changing to use
queue_physical_block_size()here and further below
Quoted 7 lines
This part I'm impartial about, not sure if it makes it more readable, hopefully we never have to support another "native sector size" apart from the two. Anyway I will send the next patch with
queue_physical_block_size()Quoted 2 lines
brq->data.blocks = queue_physical_block_size(req->q) >> SECTOR_SHIFT;Do we want to switch to
SECTOR_SHIFTinstead of 9? So farSECTOR_SHIFTis not used at all in mmc core.
I guess '9' is more consistent
Quoted 19 lines
If so I would go ahead and change all the others in another patch:
queue.c:187:q->limits.discard_granularity=card->pref_erase<< 9;
core.c:103:data->bytes_xfered= (prandom_u32()% (data->bytes_xfered>> 9)) << 9;
mmc.c:792:MMC_DEV_ATTR(erase_size, "%u\n",card->erase_size<< 9); mmc.c:793:MMC_DEV_ATTR(preferred_erase_size, "%u\n",card->pref_erase<< 9);
mmc_test.c:1557: sz = (unsigned long)test->card->pref_erase << 9;
mmc_test.c:1570:t->max_tfr=test->card->host->max_blk_count<< 9;
mmc_test.c:2461: if (repeat_cmd&& (t->blocks+ 1) << 9 >t->max_tfr)
sd.c:707:MMC_DEV_ATTR(erase_size, "%u\n",card->erase_size<< 9); sd.c:708:MMC_DEV_ATTR(preferred_erase_size, "%u\n",card->pref_erase<< 9);
block.c:1417: int i,data_size=brq->data.blocks<< 9;
block.c:1851:brq->data.bytes_xfered= blocks << 9;Hyperstone GmbH | Reichenaustr. 39a | 78467 Konstanz Managing Director: Dr. Jan Peter Berns. Commercial register of local courts: Freiburg HRB381782
...
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
brq->data.blocks = queue_physical_block_size(req->q) >> SECTOR_SHIFT;Do we want to switch to
SECTOR_SHIFTinstead of 9? So farSECTOR_SHIFTis not used at all in mmccore.
I guess '9' is more consistent
You can just multiply/divide by 512u (probably SECTOR_SIZE). (In some senses 512u is actually better!)
More obvious still and the compiler will generate a shift anyway.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)