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()
14 blk_queue_chunk_sectors(q, ns->zsze); in nvme_revalidate_zones()
15 blk_queue_max_zone_append_sectors(q, ns->ctrl->max_zone_append); in nvme_revalidate_zones()
17 return blk_revalidate_disk_zones(ns->disk, NULL); in nvme_revalidate_zones()
48 int nvme_update_zone_info(struct nvme_ns *ns, unsigned lbaf) in nvme_update_zone_info() argument
50 struct nvme_effects_log *log = ns->head->effects; in nvme_update_zone_info()
51 struct request_queue *q = ns->queue; in nvme_update_zone_info()
59 if (test_and_clear_bit(NVME_NS_FORCE_RO, &ns->flags)) 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()
64 set_bit(NVME_NS_FORCE_RO, &ns->flags); in nvme_update_zone_info()
65 dev_warn(ns->ctrl->device, in nvme_update_zone_info()
67 ns->head->ns_id); in nvme_update_zone_info()
71 if (!ns->ctrl->max_zone_append) { in nvme_update_zone_info()
72 status = nvme_set_max_append(ns->ctrl); in nvme_update_zone_info()
82 c.identify.nsid = cpu_to_le32(ns->head->ns_id); in nvme_update_zone_info()
86 status = nvme_submit_sync_cmd(ns->ctrl->admin_q, &c, id, sizeof(*id)); in nvme_update_zone_info()
95 dev_warn(ns->ctrl->device, in nvme_update_zone_info()
97 le16_to_cpu(id->zoc), ns->head->ns_id); in nvme_update_zone_info()
102 ns->zsze = nvme_lba_to_sect(ns, le64_to_cpu(id->lbafe[lbaf].zsze)); in nvme_update_zone_info()
103 if (!is_power_of_2(ns->zsze)) { in nvme_update_zone_info()
104 dev_warn(ns->ctrl->device, in nvme_update_zone_info()
106 ns->zsze, ns->head->ns_id); in nvme_update_zone_info()
111 disk_set_zoned(ns->disk, BLK_ZONED_HM); in nvme_update_zone_info()
113 disk_set_max_open_zones(ns->disk, le32_to_cpu(id->mor) + 1); in nvme_update_zone_info()
114 disk_set_max_active_zones(ns->disk, le32_to_cpu(id->mar) + 1); in nvme_update_zone_info()
120 static void *nvme_zns_alloc_report_buffer(struct nvme_ns *ns, in nvme_zns_alloc_report_buffer() argument
123 struct request_queue *q = ns->disk->queue; in nvme_zns_alloc_report_buffer()
131 get_capacity(ns->disk) >> ilog2(ns->zsze)); in nvme_zns_alloc_report_buffer()
150 static int nvme_zone_parse_entry(struct nvme_ns *ns, in nvme_zone_parse_entry() argument
158 dev_err(ns->ctrl->device, "invalid zone type %#x\n", in nvme_zone_parse_entry()
165 zone.len = ns->zsze; in nvme_zone_parse_entry()
166 zone.capacity = nvme_lba_to_sect(ns, le64_to_cpu(entry->zcap)); in nvme_zone_parse_entry()
167 zone.start = nvme_lba_to_sect(ns, le64_to_cpu(entry->zslba)); in nvme_zone_parse_entry()
171 zone.wp = nvme_lba_to_sect(ns, le64_to_cpu(entry->wp)); in nvme_zone_parse_entry()
176 int nvme_ns_report_zones(struct nvme_ns *ns, sector_t sector, in nvme_ns_report_zones() argument
185 if (ns->head->ids.csi != NVME_CSI_ZNS) in nvme_ns_report_zones()
188 report = nvme_zns_alloc_report_buffer(ns, nr_zones, &buflen); in nvme_ns_report_zones()
193 c.zmr.nsid = cpu_to_le32(ns->head->ns_id); in nvme_ns_report_zones()
199 sector &= ~(ns->zsze - 1); in nvme_ns_report_zones()
200 while (zone_idx < nr_zones && sector < get_capacity(ns->disk)) { in nvme_ns_report_zones()
203 c.zmr.slba = cpu_to_le64(nvme_sect_to_lba(ns, sector)); in nvme_ns_report_zones()
204 ret = nvme_submit_sync_cmd(ns->queue, &c, report, buflen); in nvme_ns_report_zones()
216 ret = nvme_zone_parse_entry(ns, &report->entries[i], in nvme_ns_report_zones()
223 sector += ns->zsze * nz; in nvme_ns_report_zones()
235 blk_status_t nvme_setup_zone_mgmt_send(struct nvme_ns *ns, struct request *req, in nvme_setup_zone_mgmt_send() argument
241 c->zms.nsid = cpu_to_le32(ns->head->ns_id); in nvme_setup_zone_mgmt_send()
242 c->zms.slba = cpu_to_le64(nvme_sect_to_lba(ns, blk_rq_pos(req))); in nvme_setup_zone_mgmt_send()