Lines Matching full:ns
10 int nvme_revalidate_zones(struct nvme_ns *ns) in nvme_revalidate_zones() argument
12 struct request_queue *q = ns->queue; in nvme_revalidate_zones()
15 ret = blk_revalidate_disk_zones(ns->disk, NULL); in nvme_revalidate_zones()
17 blk_queue_max_zone_append_sectors(q, ns->ctrl->max_zone_append); in nvme_revalidate_zones()
49 int nvme_update_zone_info(struct nvme_ns *ns, unsigned lbaf) in nvme_update_zone_info() argument
51 struct nvme_effects_log *log = ns->head->effects; in nvme_update_zone_info()
52 struct request_queue *q = ns->queue; in nvme_update_zone_info()
60 dev_warn(ns->ctrl->device, in nvme_update_zone_info()
62 ns->head->ns_id); in nvme_update_zone_info()
67 if (!ns->ctrl->max_zone_append) { in nvme_update_zone_info()
68 status = nvme_set_max_append(ns->ctrl); in nvme_update_zone_info()
78 c.identify.nsid = cpu_to_le32(ns->head->ns_id); in nvme_update_zone_info()
82 status = nvme_submit_sync_cmd(ns->ctrl->admin_q, &c, id, sizeof(*id)); in nvme_update_zone_info()
91 dev_warn(ns->ctrl->device, in nvme_update_zone_info()
93 le16_to_cpu(id->zoc), ns->head->ns_id); in nvme_update_zone_info()
98 ns->zsze = nvme_lba_to_sect(ns, le64_to_cpu(id->lbafe[lbaf].zsze)); in nvme_update_zone_info()
99 if (!is_power_of_2(ns->zsze)) { in nvme_update_zone_info()
100 dev_warn(ns->ctrl->device, in nvme_update_zone_info()
102 ns->zsze, ns->head->ns_id); in nvme_update_zone_info()
116 static void *nvme_zns_alloc_report_buffer(struct nvme_ns *ns, in nvme_zns_alloc_report_buffer() argument
119 struct request_queue *q = ns->disk->queue; in nvme_zns_alloc_report_buffer()
127 get_capacity(ns->disk) >> ilog2(ns->zsze)); in nvme_zns_alloc_report_buffer()
146 static int nvme_zone_parse_entry(struct nvme_ns *ns, in nvme_zone_parse_entry() argument
154 dev_err(ns->ctrl->device, "invalid zone type %#x\n", in nvme_zone_parse_entry()
161 zone.len = ns->zsze; in nvme_zone_parse_entry()
162 zone.capacity = nvme_lba_to_sect(ns, le64_to_cpu(entry->zcap)); in nvme_zone_parse_entry()
163 zone.start = nvme_lba_to_sect(ns, le64_to_cpu(entry->zslba)); in nvme_zone_parse_entry()
164 zone.wp = nvme_lba_to_sect(ns, le64_to_cpu(entry->wp)); in nvme_zone_parse_entry()
169 static int nvme_ns_report_zones(struct nvme_ns *ns, sector_t sector, in nvme_ns_report_zones() argument
178 report = nvme_zns_alloc_report_buffer(ns, nr_zones, &buflen); in nvme_ns_report_zones()
183 c.zmr.nsid = cpu_to_le32(ns->head->ns_id); in nvme_ns_report_zones()
189 sector &= ~(ns->zsze - 1); in nvme_ns_report_zones()
190 while (zone_idx < nr_zones && sector < get_capacity(ns->disk)) { in nvme_ns_report_zones()
193 c.zmr.slba = cpu_to_le64(nvme_sect_to_lba(ns, sector)); in nvme_ns_report_zones()
194 ret = nvme_submit_sync_cmd(ns->queue, &c, report, buflen); in nvme_ns_report_zones()
206 ret = nvme_zone_parse_entry(ns, &report->entries[i], in nvme_ns_report_zones()
213 sector += ns->zsze * nz; in nvme_ns_report_zones()
229 struct nvme_ns *ns; in nvme_report_zones() local
232 ns = nvme_get_ns_from_disk(disk, &head, &srcu_idx); in nvme_report_zones()
233 if (unlikely(!ns)) in nvme_report_zones()
236 if (ns->head->ids.csi == NVME_CSI_ZNS) in nvme_report_zones()
237 ret = nvme_ns_report_zones(ns, sector, nr_zones, cb, data); in nvme_report_zones()
245 blk_status_t nvme_setup_zone_mgmt_send(struct nvme_ns *ns, struct request *req, in nvme_setup_zone_mgmt_send() argument
249 c->zms.nsid = cpu_to_le32(ns->head->ns_id); in nvme_setup_zone_mgmt_send()
250 c->zms.slba = cpu_to_le64(nvme_sect_to_lba(ns, blk_rq_pos(req))); in nvme_setup_zone_mgmt_send()