mbox series

[v4,0/7] Code cleanup and memory usage reduction

Message ID 20240902230715.176522-1-dlemoal@kernel.org
Headers show
Series Code cleanup and memory usage reduction | expand

Message

Damien Le Moal Sept. 2, 2024, 11:07 p.m. UTC
Patch 1 of this series cleans up libata-transport (avoid forward
declarations and improved kdoc comments).

Patch 2 introduces a small simplification/improvement of
__ata_qc_complete().

Patches 3 and 4 move code that is SATA specific from libata-core.c to
libata-sata.c, without any functional change. The benefits of this code
reorganization is a smaller libata binary size for hosts that do not
support SATA.

Patch 5 renames some functions to make it clearer what the functions do.

Finally, patch 6 and 7 reduce memory usage of libata by:
 - Moving the sector_buf buffer from struct ata_port to struct
   ata_device
 - Agregating CDL related buffers together into a new ata_cdl structure
   and referencing this new structure from struct ata_device only for
   devices that support CDL.

Changes from V3:
 - Small change to struct ata_cdl kzalloc() call as suggested by Niklas
 - Removed bogus call to ata_dev_cleanup_cdl_resources() in patch 7
 - Added review tags

Changes from V2:
 - Reworked patch 1 to address Hannes' comments
 - Added Hannes' review tags

Changes from V1:
 - Reworked patch 1 to do more cleanups
 - Added patch 6. The former patch 6 of v1 is now squashed into patch 7
 - Added Niklas review tags

Damien Le Moal (7):
  ata: libata: Cleanup libata-transport
  ata: libata: Improve __ata_qc_complete()
  ata: libata: Move sata_down_spd_limit() to libata-sata.c
  ata: libata: Move sata_std_hardreset() definition to libata-sata.c
  ata: libata: Rename ata_eh_read_sense_success_ncq_log()
  ata: libata: Move sector_buf from struct ata_port to struct ata_device
  ata: libata: Improve CDL resource management

 drivers/ata/libata-core.c      | 264 +++++++++--------------------
 drivers/ata/libata-eh.c        |  10 +-
 drivers/ata/libata-pmp.c       |   3 +-
 drivers/ata/libata-sata.c      | 127 +++++++++++++-
 drivers/ata/libata-scsi.c      |   2 +-
 drivers/ata/libata-transport.c | 299 ++++++++++++++++-----------------
 drivers/ata/libata-zpodd.c     |   2 +-
 drivers/ata/libata.h           |  23 ++-
 include/linux/libata.h         |  39 +++--
 9 files changed, 406 insertions(+), 363 deletions(-)