@@ -316,7 +316,7 @@ static void nvme_log_error(struct request *req)
316
316
ns -> disk ? ns -> disk -> disk_name : "?" ,
317
317
nvme_get_opcode_str (nr -> cmd -> common .opcode ),
318
318
nr -> cmd -> common .opcode ,
319
- nvme_sect_to_lba (ns , blk_rq_pos (req )),
319
+ nvme_sect_to_lba (ns -> head , blk_rq_pos (req )),
320
320
blk_rq_bytes (req ) >> ns -> head -> lba_shift ,
321
321
nvme_get_error_status_str (nr -> status ),
322
322
nr -> status >> 8 & 7 , /* Status Code Type */
@@ -372,9 +372,12 @@ static inline enum nvme_disposition nvme_decide_disposition(struct request *req)
372
372
static inline void nvme_end_req_zoned (struct request * req )
373
373
{
374
374
if (IS_ENABLED (CONFIG_BLK_DEV_ZONED ) &&
375
- req_op (req ) == REQ_OP_ZONE_APPEND )
376
- req -> __sector = nvme_lba_to_sect (req -> q -> queuedata ,
375
+ req_op (req ) == REQ_OP_ZONE_APPEND ) {
376
+ struct nvme_ns * ns = req -> q -> queuedata ;
377
+
378
+ req -> __sector = nvme_lba_to_sect (ns -> head ,
377
379
le64_to_cpu (nvme_req (req )-> result .u64 ));
380
+ }
378
381
}
379
382
380
383
static inline void nvme_end_req (struct request * req )
@@ -791,7 +794,7 @@ static blk_status_t nvme_setup_discard(struct nvme_ns *ns, struct request *req,
791
794
}
792
795
793
796
if (queue_max_discard_segments (req -> q ) == 1 ) {
794
- u64 slba = nvme_sect_to_lba (ns , blk_rq_pos (req ));
797
+ u64 slba = nvme_sect_to_lba (ns -> head , blk_rq_pos (req ));
795
798
u32 nlb = blk_rq_sectors (req ) >> (ns -> head -> lba_shift - 9 );
796
799
797
800
range [0 ].cattr = cpu_to_le32 (0 );
@@ -800,7 +803,8 @@ static blk_status_t nvme_setup_discard(struct nvme_ns *ns, struct request *req,
800
803
n = 1 ;
801
804
} else {
802
805
__rq_for_each_bio (bio , req ) {
803
- u64 slba = nvme_sect_to_lba (ns , bio -> bi_iter .bi_sector );
806
+ u64 slba = nvme_sect_to_lba (ns -> head ,
807
+ bio -> bi_iter .bi_sector );
804
808
u32 nlb = bio -> bi_iter .bi_size >> ns -> head -> lba_shift ;
805
809
806
810
if (n < segments ) {
@@ -867,15 +871,15 @@ static inline blk_status_t nvme_setup_write_zeroes(struct nvme_ns *ns,
867
871
cmnd -> write_zeroes .opcode = nvme_cmd_write_zeroes ;
868
872
cmnd -> write_zeroes .nsid = cpu_to_le32 (ns -> head -> ns_id );
869
873
cmnd -> write_zeroes .slba =
870
- cpu_to_le64 (nvme_sect_to_lba (ns , blk_rq_pos (req )));
874
+ cpu_to_le64 (nvme_sect_to_lba (ns -> head , blk_rq_pos (req )));
871
875
cmnd -> write_zeroes .length =
872
876
cpu_to_le16 ((blk_rq_bytes (req ) >> ns -> head -> lba_shift ) - 1 );
873
877
874
878
if (!(req -> cmd_flags & REQ_NOUNMAP ) &&
875
879
(ns -> head -> features & NVME_NS_DEAC ))
876
880
cmnd -> write_zeroes .control |= cpu_to_le16 (NVME_WZ_DEAC );
877
881
878
- if (nvme_ns_has_pi (ns )) {
882
+ if (nvme_ns_has_pi (ns -> head )) {
879
883
cmnd -> write_zeroes .control |= cpu_to_le16 (NVME_RW_PRINFO_PRACT );
880
884
881
885
switch (ns -> head -> pi_type ) {
@@ -910,7 +914,8 @@ static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns,
910
914
cmnd -> rw .cdw2 = 0 ;
911
915
cmnd -> rw .cdw3 = 0 ;
912
916
cmnd -> rw .metadata = 0 ;
913
- cmnd -> rw .slba = cpu_to_le64 (nvme_sect_to_lba (ns , blk_rq_pos (req )));
917
+ cmnd -> rw .slba =
918
+ cpu_to_le64 (nvme_sect_to_lba (ns -> head , blk_rq_pos (req )));
914
919
cmnd -> rw .length =
915
920
cpu_to_le16 ((blk_rq_bytes (req ) >> ns -> head -> lba_shift ) - 1 );
916
921
cmnd -> rw .reftag = 0 ;
@@ -925,7 +930,7 @@ static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns,
925
930
* namespace capacity to zero to prevent any I/O.
926
931
*/
927
932
if (!blk_integrity_rq (req )) {
928
- if (WARN_ON_ONCE (!nvme_ns_has_pi (ns )))
933
+ if (WARN_ON_ONCE (!nvme_ns_has_pi (ns -> head )))
929
934
return BLK_STS_NOTSUPP ;
930
935
control |= NVME_RW_PRINFO_PRACT ;
931
936
}
@@ -1723,8 +1728,9 @@ static void nvme_config_discard(struct gendisk *disk, struct nvme_ns *ns)
1723
1728
struct request_queue * queue = disk -> queue ;
1724
1729
u32 size = queue_logical_block_size (queue );
1725
1730
1726
- if (ctrl -> dmrsl && ctrl -> dmrsl <= nvme_sect_to_lba (ns , UINT_MAX ))
1727
- ctrl -> max_discard_sectors = nvme_lba_to_sect (ns , ctrl -> dmrsl );
1731
+ if (ctrl -> dmrsl && ctrl -> dmrsl <= nvme_sect_to_lba (ns -> head , UINT_MAX ))
1732
+ ctrl -> max_discard_sectors =
1733
+ nvme_lba_to_sect (ns -> head , ctrl -> dmrsl );
1728
1734
1729
1735
if (ctrl -> max_discard_sectors == 0 ) {
1730
1736
blk_queue_max_discard_sectors (queue , 0 );
@@ -1848,7 +1854,7 @@ static int nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id)
1848
1854
* Note, this check will need to be modified if any drivers
1849
1855
* gain the ability to use other metadata formats.
1850
1856
*/
1851
- if (ctrl -> max_integrity_segments && nvme_ns_has_pi (ns ))
1857
+ if (ctrl -> max_integrity_segments && nvme_ns_has_pi (ns -> head ))
1852
1858
ns -> head -> features |= NVME_NS_METADATA_SUPPORTED ;
1853
1859
} else {
1854
1860
/*
@@ -1886,7 +1892,7 @@ static void nvme_set_queue_limits(struct nvme_ctrl *ctrl,
1886
1892
static void nvme_update_disk_info (struct gendisk * disk ,
1887
1893
struct nvme_ns * ns , struct nvme_id_ns * id )
1888
1894
{
1889
- sector_t capacity = nvme_lba_to_sect (ns , le64_to_cpu (id -> nsze ));
1895
+ sector_t capacity = nvme_lba_to_sect (ns -> head , le64_to_cpu (id -> nsze ));
1890
1896
u32 bs = 1U << ns -> head -> lba_shift ;
1891
1897
u32 atomic_bs , phys_bs , io_opt = 0 ;
1892
1898
@@ -1942,7 +1948,7 @@ static void nvme_update_disk_info(struct gendisk *disk,
1942
1948
(ns -> head -> features & NVME_NS_METADATA_SUPPORTED ))
1943
1949
nvme_init_integrity (disk , ns ,
1944
1950
ns -> ctrl -> max_integrity_segments );
1945
- else if (!nvme_ns_has_pi (ns ))
1951
+ else if (!nvme_ns_has_pi (ns -> head ))
1946
1952
capacity = 0 ;
1947
1953
}
1948
1954
@@ -1973,7 +1979,7 @@ static void nvme_set_chunk_sectors(struct nvme_ns *ns, struct nvme_id_ns *id)
1973
1979
is_power_of_2 (ctrl -> max_hw_sectors ))
1974
1980
iob = ctrl -> max_hw_sectors ;
1975
1981
else
1976
- iob = nvme_lba_to_sect (ns , le16_to_cpu (id -> noiob ));
1982
+ iob = nvme_lba_to_sect (ns -> head , le16_to_cpu (id -> noiob ));
1977
1983
1978
1984
if (!iob )
1979
1985
return ;
0 commit comments