On Mon, 24 Jun 2019 at 08:24, Christoph Hellwig <hch@xxxxxx> wrote: > > On Thu, Jun 20, 2019 at 05:50:10PM +0900, Yoshihiro Shimoda wrote: > > When the max_segs of a mmc host is smaller than 512, the mmc > > subsystem tries to use 512 segments if DMA MAP layer can merge > > the segments, and then the mmc subsystem exposes such information > > to the block layer by using blk_queue_can_use_dma_map_merging(). > > > > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx> > > --- > > drivers/mmc/core/queue.c | 35 ++++++++++++++++++++++++++++++++--- > > include/linux/mmc/host.h | 1 + > > 2 files changed, 33 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c > > index 92900a0..ab0ecc6 100644 > > --- a/drivers/mmc/core/queue.c > > +++ b/drivers/mmc/core/queue.c > > @@ -24,6 +24,8 @@ > > #include "card.h" > > #include "host.h" > > > > +#define MMC_DMA_MAP_MERGE_SEGMENTS 512 > > + > > static inline bool mmc_cqe_dcmd_busy(struct mmc_queue *mq) > > { > > /* Allow only 1 DCMD at a time */ > > @@ -196,6 +198,12 @@ static void mmc_queue_setup_discard(struct request_queue *q, > > blk_queue_flag_set(QUEUE_FLAG_SECERASE, q); > > } > > > > +static unsigned int mmc_get_max_segments(struct mmc_host *host) > > +{ > > + return host->can_dma_map_merge ? MMC_DMA_MAP_MERGE_SEGMENTS : > > + host->max_segs; > > I personally don't like superflous use of ? : if an if would be more > obvious: > > if (host->can_dma_map_merge) > return MMC_DMA_MAP_MERGE_SEGMENTS; > return host->max_segs; > > but that is really just a nitpick and for the mmc maintainer to decide. I have no strong opinions, both formats are used in mmc code, so I am fine as is. > > Otherwise looks good: > > Reviewed-by: Christoph Hellwig <hch@xxxxxx> Reviewed-by: Ulf Hansson <ulf.hansson@xxxxxxxxxx> Kind regards Uffe