Skip to contentSkip to conversation

nvmet: report ns's vwc not present

PATCH Applied Guixin Liu 4 participants 4 messages Nov 13, 2024

Subsystems (2)
lore
Share & tools
lore

Guixin Liu

author
#0 lore raw

PATCH v5 1/1 nvmet: report ns's vwc not present

Currently, we report that controller has vwc even though the ns may not have vwc. Report ns's vwc not present when not buffered_io or backdev doesn't have vwc.

---
Based on Keith's v4 patch,
Changes from v4 to v5:
- When the backend is file, report support vwc even though buffered_io is disable, and add an annotation to expain it.

 drivers/nvme/target/admin-cmd.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/nvme/target/admin-cmd.c +7 -0
index 0a9fdc533186..934b401fbc2f 100644
@@ -934,6 +934,13 @@ static void nvmet_execute_id_cs_indep(struct nvmet_req *req)
 		id->nsattr |= NVME_NS_ATTR_RO;
 	if (req->ns->bdev && !bdev_nonrot(req->ns->bdev))
 		id->nsfeat |= NVME_NS_ROTATIONAL;
+	/*
+	 * We need flush command to flush the file's metadata,
+	 * so report supporting vwc if backend is file, even
+	 * though buffered_io is disable.
+	 */
+	if (req->ns->bdev && !bdev_write_cache(req->ns->bdev))
+		id->nsfeat |= NVME_NS_VWC_NOT_PRESENT;
 
 	status = nvmet_copy_to_sgl(req, 0, id, sizeof(*id));
 	kfree(id);
Signature · 1 line
2.43.0
maintainer Applied
#3 lore raw
In reply to Guixin Liu
Quoted 3 lines · Guixin Liu

Currently, we report that controller has vwc even though the ns may not have vwc. Report ns's vwc not present when not buffered_io or backdev doesn't have vwc.

Thanks, applied to nvme-6.13.