mirror of
https://github.com/torvalds/linux.git
synced 2026-06-08 14:42:37 +02:00
Revert "Revert "mmc: block: Issue a cache flush only when it's enabled""
This reverts commit 36c1596556.
Bring back the commit in 5.10.36 that broke the kabi.
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Id4a80652b7b702c620626606fdbdd6565584e27c
This commit is contained in:
parent
e606ad4aae
commit
51dc321c7d
|
|
@ -2236,6 +2236,10 @@ enum mmc_issued mmc_blk_mq_issue_rq(struct mmc_queue *mq, struct request *req)
|
||||||
case MMC_ISSUE_ASYNC:
|
case MMC_ISSUE_ASYNC:
|
||||||
switch (req_op(req)) {
|
switch (req_op(req)) {
|
||||||
case REQ_OP_FLUSH:
|
case REQ_OP_FLUSH:
|
||||||
|
if (!mmc_cache_enabled(host)) {
|
||||||
|
blk_mq_end_request(req, BLK_STS_OK);
|
||||||
|
return MMC_REQ_FINISHED;
|
||||||
|
}
|
||||||
ret = mmc_blk_cqe_issue_flush(mq, req);
|
ret = mmc_blk_cqe_issue_flush(mq, req);
|
||||||
break;
|
break;
|
||||||
case REQ_OP_READ:
|
case REQ_OP_READ:
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ struct mmc_bus_ops {
|
||||||
int (*shutdown)(struct mmc_host *);
|
int (*shutdown)(struct mmc_host *);
|
||||||
int (*hw_reset)(struct mmc_host *);
|
int (*hw_reset)(struct mmc_host *);
|
||||||
int (*sw_reset)(struct mmc_host *);
|
int (*sw_reset)(struct mmc_host *);
|
||||||
|
bool (*cache_enabled)(struct mmc_host *);
|
||||||
};
|
};
|
||||||
|
|
||||||
void mmc_attach_bus(struct mmc_host *host, const struct mmc_bus_ops *ops);
|
void mmc_attach_bus(struct mmc_host *host, const struct mmc_bus_ops *ops);
|
||||||
|
|
@ -163,4 +164,12 @@ static inline void mmc_post_req(struct mmc_host *host, struct mmc_request *mrq,
|
||||||
host->ops->post_req(host, mrq, err);
|
host->ops->post_req(host, mrq, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool mmc_cache_enabled(struct mmc_host *host)
|
||||||
|
{
|
||||||
|
if (host->bus_ops->cache_enabled)
|
||||||
|
return host->bus_ops->cache_enabled(host);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -2033,6 +2033,12 @@ static void mmc_detect(struct mmc_host *host)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool _mmc_cache_enabled(struct mmc_host *host)
|
||||||
|
{
|
||||||
|
return host->card->ext_csd.cache_size > 0 &&
|
||||||
|
host->card->ext_csd.cache_ctrl & 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int _mmc_suspend(struct mmc_host *host, bool is_suspend)
|
static int _mmc_suspend(struct mmc_host *host, bool is_suspend)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
@ -2212,6 +2218,7 @@ static const struct mmc_bus_ops mmc_ops = {
|
||||||
.alive = mmc_alive,
|
.alive = mmc_alive,
|
||||||
.shutdown = mmc_shutdown,
|
.shutdown = mmc_shutdown,
|
||||||
.hw_reset = _mmc_hw_reset,
|
.hw_reset = _mmc_hw_reset,
|
||||||
|
.cache_enabled = _mmc_cache_enabled,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -988,9 +988,7 @@ int mmc_flush_cache(struct mmc_card *card)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
if (mmc_card_mmc(card) &&
|
if (mmc_cache_enabled(card->host)) {
|
||||||
(card->ext_csd.cache_size > 0) &&
|
|
||||||
(card->ext_csd.cache_ctrl & 1)) {
|
|
||||||
err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
|
err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
|
||||||
EXT_CSD_FLUSH_CACHE, 1,
|
EXT_CSD_FLUSH_CACHE, 1,
|
||||||
MMC_CACHE_FLUSH_TIMEOUT_MS);
|
MMC_CACHE_FLUSH_TIMEOUT_MS);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user