@@ -176,7 +176,7 @@ static inline int mmc_blk_part_switch(struct mmc_card *card,
176176 unsigned int part_type );
177177static void mmc_blk_rw_rq_prep (struct mmc_queue_req * mqrq ,
178178 struct mmc_card * card ,
179- int disable_multi ,
179+ int recovery_mode ,
180180 struct mmc_queue * mq );
181181static void mmc_blk_hsq_req_done (struct mmc_request * mrq );
182182
@@ -1302,7 +1302,7 @@ static void mmc_blk_eval_resp_error(struct mmc_blk_request *brq)
13021302}
13031303
13041304static void mmc_blk_data_prep (struct mmc_queue * mq , struct mmc_queue_req * mqrq ,
1305- int disable_multi , bool * do_rel_wr_p ,
1305+ int recovery_mode , bool * do_rel_wr_p ,
13061306 bool * do_data_tag_p )
13071307{
13081308 struct mmc_blk_data * md = mq -> blkdata ;
@@ -1368,12 +1368,12 @@ static void mmc_blk_data_prep(struct mmc_queue *mq, struct mmc_queue_req *mqrq,
13681368 brq -> data .blocks -- ;
13691369
13701370 /*
1371- * After a read error, we redo the request one sector
1371+ * After a read error, we redo the request one (native) sector
13721372 * at a time in order to accurately determine which
13731373 * sectors can be read successfully.
13741374 */
1375- if (disable_multi )
1376- brq -> data .blocks = 1 ;
1375+ if (recovery_mode )
1376+ brq -> data .blocks = queue_physical_block_size ( mq -> queue ) >> 9 ;
13771377
13781378 /*
13791379 * Some controllers have HW issues while operating
@@ -1590,7 +1590,7 @@ static int mmc_blk_cqe_issue_rw_rq(struct mmc_queue *mq, struct request *req)
15901590
15911591static void mmc_blk_rw_rq_prep (struct mmc_queue_req * mqrq ,
15921592 struct mmc_card * card ,
1593- int disable_multi ,
1593+ int recovery_mode ,
15941594 struct mmc_queue * mq )
15951595{
15961596 u32 readcmd , writecmd ;
@@ -1599,7 +1599,7 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
15991599 struct mmc_blk_data * md = mq -> blkdata ;
16001600 bool do_rel_wr , do_data_tag ;
16011601
1602- mmc_blk_data_prep (mq , mqrq , disable_multi , & do_rel_wr , & do_data_tag );
1602+ mmc_blk_data_prep (mq , mqrq , recovery_mode , & do_rel_wr , & do_data_tag );
16031603
16041604 brq -> mrq .cmd = & brq -> cmd ;
16051605
@@ -1690,14 +1690,15 @@ static int mmc_blk_fix_state(struct mmc_card *card, struct request *req)
16901690
16911691#define MMC_READ_SINGLE_RETRIES 2
16921692
1693- /* Single sector read during recovery */
1693+ /* Single (native) sector read during recovery */
16941694static void mmc_blk_read_single (struct mmc_queue * mq , struct request * req )
16951695{
16961696 struct mmc_queue_req * mqrq = req_to_mmc_queue_req (req );
16971697 struct mmc_request * mrq = & mqrq -> brq .mrq ;
16981698 struct mmc_card * card = mq -> card ;
16991699 struct mmc_host * host = card -> host ;
17001700 blk_status_t error = BLK_STS_OK ;
1701+ size_t bytes_per_read = queue_physical_block_size (mq -> queue );
17011702
17021703 do {
17031704 u32 status ;
@@ -1732,13 +1733,13 @@ static void mmc_blk_read_single(struct mmc_queue *mq, struct request *req)
17321733 else
17331734 error = BLK_STS_OK ;
17341735
1735- } while (blk_update_request (req , error , 512 ));
1736+ } while (blk_update_request (req , error , bytes_per_read ));
17361737
17371738 return ;
17381739
17391740error_exit :
17401741 mrq -> data -> bytes_xfered = 0 ;
1741- blk_update_request (req , BLK_STS_IOERR , 512 );
1742+ blk_update_request (req , BLK_STS_IOERR , bytes_per_read );
17421743 /* Let it try the remaining request again */
17431744 if (mqrq -> retries > MMC_MAX_RETRIES - 1 )
17441745 mqrq -> retries = MMC_MAX_RETRIES - 1 ;
@@ -1879,10 +1880,9 @@ static void mmc_blk_mq_rw_recovery(struct mmc_queue *mq, struct request *req)
18791880 return ;
18801881 }
18811882
1882- /* FIXME: Missing single sector read for large sector size */
1883- if (!mmc_large_sector (card ) && rq_data_dir (req ) == READ &&
1884- brq -> data .blocks > 1 ) {
1885- /* Read one sector at a time */
1883+ if (rq_data_dir (req ) == READ && brq -> data .blocks >
1884+ queue_physical_block_size (mq -> queue ) >> 9 ) {
1885+ /* Read one (native) sector at a time */
18861886 mmc_blk_read_single (mq , req );
18871887 return ;
18881888 }
0 commit comments