]> git.neil.brown.name Git - linux.git/blobdiff - drivers/nvme/target/core.c
nvmet: add a new nvmet_zero_sgl helper
[linux.git] / drivers / nvme / target / core.c
index 800aaf96ddcd42f3094847bfb42207715567e35d..55c4bc693aa2ff6514bbf0e17fd74d456cb129e6 100644 (file)
@@ -57,6 +57,13 @@ u16 nvmet_copy_from_sgl(struct nvmet_req *req, off_t off, void *buf, size_t len)
        return 0;
 }
 
+u16 nvmet_zero_sgl(struct nvmet_req *req, off_t off, size_t len)
+{
+       if (sg_zero_buffer(req->sg, req->sg_cnt, len, off) != len)
+               return NVME_SC_SGL_INVALID_DATA | NVME_SC_DNR;
+       return 0;
+}
+
 static unsigned int nvmet_max_nsid(struct nvmet_subsys *subsys)
 {
        struct nvmet_ns *ns;