1

nvme fixes for Linux 6.11

- Cleanups and improved struct packing (Kanchan)
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE3Fbyvv+648XNRdHTPe3zGtjzRgkFAma0+NAACgkQPe3zGtjz
 RglzSRAA2gx8p2HM5IjjFNQa1RDXJmSEZX345HueG+a87OgUiGIdR7foNuLjcJBp
 CBf7vk2xyMcRWCHq0w80LUhwB0qI2nFo1rzu5mElEICXk+4Hw/1bC8nTuEs8MRUb
 Zi+RdoFATOwGEbUBJlMLprJw6K94xXOcPEjjB92ZDfiEoE2vbgmLPMMv9Z0yndOE
 fgfcD8kSKpyT7GotNVsWIrO7BT6USb9z7G+0M349ajywFxLkZgHZ01hxq8EJWkul
 Vy22/7fNOxxAs/78pPudmE/Z5zLb3u0AJxhAY4PVskr3bBaiOGQVuktdT1j1JIyN
 +aPnjIhjxN5F3yMPVs4cCD3tVScxri6+FwJZ3IFmtVdXNuPi06tZwJl2NmE6CrAY
 zJHBsE+AjIPtv98+6n/dpjzpDv1QLOhWcRMpaUkfcehCxI8KEcHKp08kjKBJVBX8
 QgHL0fazBQ3XBzTSZM+P8NH2K/+E/VdpgIuOV/LvFdy5dFSA1E1umuqKsDLkzklV
 3zjavL6QWwI1Xd2N/rEM1zl6Sn51Rf2nMZ93ixxhGefhU/5eLCG6DNvjklzsr30d
 iutvisP7uzXDIyk3AN5Uxdi29qnucs7fPi/5D1DZfgsIBZhp28vyCaAvXuOY6tL2
 l0yN5mbXJuPxXsW/+D2micFh3E+FRUNIVrABs4p0/T1eXgjNhHk=
 =OJUs
 -----END PGP SIGNATURE-----

Merge tag 'nvme-6.11-2024-08-08' of git://git.infradead.org/nvme into block-6.11

Pull NVMe fixes from Keith:

"nvme fixes for Linux 6.11

 - Cleanups and improved struct packing (Kanchan)"

* tag 'nvme-6.11-2024-08-08' of git://git.infradead.org/nvme:
  nvme: reorganize nvme_ns_head fields
  nvme: change data type of lba_shift
  nvme: remove a field from nvme_ns_head
  nvme: remove unused parameter
This commit is contained in:
Jens Axboe 2024-08-08 12:27:40 -06:00
commit eded04fe3b
2 changed files with 15 additions and 16 deletions

View File

@ -36,6 +36,7 @@ struct nvme_ns_info {
struct nvme_ns_ids ids;
u32 nsid;
__le32 anagrpid;
u8 pi_offset;
bool is_shared;
bool is_readonly;
bool is_ready;
@ -1757,8 +1758,8 @@ int nvme_getgeo(struct block_device *bdev, struct hd_geometry *geo)
return 0;
}
static bool nvme_init_integrity(struct gendisk *disk, struct nvme_ns_head *head,
struct queue_limits *lim)
static bool nvme_init_integrity(struct nvme_ns_head *head,
struct queue_limits *lim, struct nvme_ns_info *info)
{
struct blk_integrity *bi = &lim->integrity;
@ -1816,7 +1817,7 @@ static bool nvme_init_integrity(struct gendisk *disk, struct nvme_ns_head *head,
}
bi->tuple_size = head->ms;
bi->pi_offset = head->pi_offset;
bi->pi_offset = info->pi_offset;
return true;
}
@ -1902,12 +1903,11 @@ static void nvme_configure_pi_elbas(struct nvme_ns_head *head,
static void nvme_configure_metadata(struct nvme_ctrl *ctrl,
struct nvme_ns_head *head, struct nvme_id_ns *id,
struct nvme_id_ns_nvm *nvm)
struct nvme_id_ns_nvm *nvm, struct nvme_ns_info *info)
{
head->features &= ~(NVME_NS_METADATA_SUPPORTED | NVME_NS_EXT_LBAS);
head->pi_type = 0;
head->pi_size = 0;
head->pi_offset = 0;
head->ms = le16_to_cpu(id->lbaf[nvme_lbaf_index(id->flbas)].ms);
if (!head->ms || !(ctrl->ops->flags & NVME_F_METADATA_SUPPORTED))
return;
@ -1922,7 +1922,7 @@ static void nvme_configure_metadata(struct nvme_ctrl *ctrl,
if (head->pi_size && head->ms >= head->pi_size)
head->pi_type = id->dps & NVME_NS_DPS_PI_MASK;
if (!(id->dps & NVME_NS_DPS_PI_FIRST))
head->pi_offset = head->ms - head->pi_size;
info->pi_offset = head->ms - head->pi_size;
if (ctrl->ops->flags & NVME_F_FABRICS) {
/*
@ -2156,7 +2156,7 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns,
lim = queue_limits_start_update(ns->disk->queue);
nvme_set_ctrl_limits(ns->ctrl, &lim);
nvme_configure_metadata(ns->ctrl, ns->head, id, nvm);
nvme_configure_metadata(ns->ctrl, ns->head, id, nvm, info);
nvme_set_chunk_sectors(ns, id, &lim);
if (!nvme_update_disk_info(ns, id, &lim))
capacity = 0;
@ -2176,7 +2176,7 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns,
* I/O to namespaces with metadata except when the namespace supports
* PI, as it can strip/insert in that case.
*/
if (!nvme_init_integrity(ns->disk, ns->head, &lim))
if (!nvme_init_integrity(ns->head, &lim, info))
capacity = 0;
ret = queue_limits_commit_update(ns->disk->queue, &lim);
@ -2280,7 +2280,7 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_ns_info *info)
if (unsupported)
ns->head->disk->flags |= GENHD_FL_HIDDEN;
else
nvme_init_integrity(ns->head->disk, ns->head, &lim);
nvme_init_integrity(ns->head, &lim, info);
ret = queue_limits_commit_update(ns->head->disk->queue, &lim);
set_capacity_and_notify(ns->head->disk, get_capacity(ns->disk));

View File

@ -462,20 +462,19 @@ struct nvme_ns_head {
struct srcu_struct srcu;
struct nvme_subsystem *subsys;
struct nvme_ns_ids ids;
u8 lba_shift;
u16 ms;
u16 pi_size;
u8 pi_type;
u8 guard_type;
struct list_head entry;
struct kref ref;
bool shared;
bool passthru_err_log_enabled;
int instance;
struct nvme_effects_log *effects;
u64 nuse;
unsigned ns_id;
int lba_shift;
u16 ms;
u16 pi_size;
u8 pi_type;
u8 pi_offset;
u8 guard_type;
int instance;
#ifdef CONFIG_BLK_DEV_ZONED
u64 zsze;
#endif