Lines Matching refs: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 if (test_and_clear_bit(NVME_NS_FORCE_RO, &ns->flags)) in nvme_update_zone_info()
61 dev_warn(ns->ctrl->device, in nvme_update_zone_info()
63 ns->head->ns_id); in nvme_update_zone_info()
65 set_bit(NVME_NS_FORCE_RO, &ns->flags); in nvme_update_zone_info()
66 dev_warn(ns->ctrl->device, in nvme_update_zone_info()
68 ns->head->ns_id); in nvme_update_zone_info()
72 if (!ns->ctrl->max_zone_append) { in nvme_update_zone_info()
73 status = nvme_set_max_append(ns->ctrl); in nvme_update_zone_info()
83 c.identify.nsid = cpu_to_le32(ns->head->ns_id); in nvme_update_zone_info()
87 status = nvme_submit_sync_cmd(ns->ctrl->admin_q, &c, id, sizeof(*id)); in nvme_update_zone_info()
96 dev_warn(ns->ctrl->device, in nvme_update_zone_info()
98 le16_to_cpu(id->zoc), ns->head->ns_id); in nvme_update_zone_info()
103 ns->zsze = nvme_lba_to_sect(ns, le64_to_cpu(id->lbafe[lbaf].zsze)); in nvme_update_zone_info()
104 if (!is_power_of_2(ns->zsze)) { in nvme_update_zone_info()
105 dev_warn(ns->ctrl->device, in nvme_update_zone_info()
107 ns->zsze, ns->head->ns_id); in nvme_update_zone_info()
112 blk_queue_set_zoned(ns->disk, BLK_ZONED_HM); in nvme_update_zone_info()
121 static void *nvme_zns_alloc_report_buffer(struct nvme_ns *ns, in nvme_zns_alloc_report_buffer() argument
124 struct request_queue *q = ns->disk->queue; in nvme_zns_alloc_report_buffer()
132 get_capacity(ns->disk) >> ilog2(ns->zsze)); in nvme_zns_alloc_report_buffer()
151 static int nvme_zone_parse_entry(struct nvme_ns *ns, in nvme_zone_parse_entry() argument
159 dev_err(ns->ctrl->device, "invalid zone type %#x\n", in nvme_zone_parse_entry()
166 zone.len = ns->zsze; in nvme_zone_parse_entry()
167 zone.capacity = nvme_lba_to_sect(ns, le64_to_cpu(entry->zcap)); in nvme_zone_parse_entry()
168 zone.start = nvme_lba_to_sect(ns, le64_to_cpu(entry->zslba)); in nvme_zone_parse_entry()
172 zone.wp = nvme_lba_to_sect(ns, le64_to_cpu(entry->wp)); in nvme_zone_parse_entry()
177 int nvme_ns_report_zones(struct nvme_ns *ns, sector_t sector, in nvme_ns_report_zones() argument
186 if (ns->head->ids.csi != NVME_CSI_ZNS) in nvme_ns_report_zones()
189 report = nvme_zns_alloc_report_buffer(ns, nr_zones, &buflen); in nvme_ns_report_zones()
194 c.zmr.nsid = cpu_to_le32(ns->head->ns_id); in nvme_ns_report_zones()
200 sector &= ~(ns->zsze - 1); in nvme_ns_report_zones()
201 while (zone_idx < nr_zones && sector < get_capacity(ns->disk)) { in nvme_ns_report_zones()
204 c.zmr.slba = cpu_to_le64(nvme_sect_to_lba(ns, sector)); in nvme_ns_report_zones()
205 ret = nvme_submit_sync_cmd(ns->queue, &c, report, buflen); in nvme_ns_report_zones()
217 ret = nvme_zone_parse_entry(ns, &report->entries[i], in nvme_ns_report_zones()
224 sector += ns->zsze * nz; in nvme_ns_report_zones()
236 blk_status_t nvme_setup_zone_mgmt_send(struct nvme_ns *ns, struct request *req, in nvme_setup_zone_mgmt_send() argument
242 c->zms.nsid = cpu_to_le32(ns->head->ns_id); in nvme_setup_zone_mgmt_send()
243 c->zms.slba = cpu_to_le64(nvme_sect_to_lba(ns, blk_rq_pos(req))); in nvme_setup_zone_mgmt_send()