dm: storage: support discard command

Support DISCARD command is meaningful when eMMC usage is high or
there are lots of remove operations. For example, when Guest
Android is running, there will be lots of files being created and
removed. However, virtio-blk BE does not support DISCARD command,
data remove operation in UOS will not trigger erase in eMMC. After
period of time, the eMMC will be consumed out, and erase must be
done by eMMC firmware before writing any new data. This causes the
eMMC performance decrease in the whole system (SOS and UOS).
To solve the problem, DISCARD should be supported in virtio-blk BE.

Tracked-On: #2011
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
Conghui Chen
2018-12-14 09:50:15 +08:00
committed by wenlingz
parent f71370ad81
commit 2ddd24e022
3 changed files with 190 additions and 22 deletions

View File

@@ -69,5 +69,8 @@ int blockif_close(struct blockif_ctxt *bc);
uint8_t blockif_get_wce(struct blockif_ctxt *bc);
void blockif_set_wce(struct blockif_ctxt *bc, uint8_t wce);
int blockif_flush_all(struct blockif_ctxt *bc);
int blockif_max_discard_sectors(struct blockif_ctxt *bc);
int blockif_max_discard_seg(struct blockif_ctxt *bc);
int blockif_discard_sector_alignment(struct blockif_ctxt *bc);
#endif /* _BLOCK_IF_H_ */