ata_format_dsm_trim_descr(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay bestie, this is ata_format_dsm_trim_descr(9) from the Kernel API Manual β€” yes, the manual name is right there, and the whole page is giving kernel-helper main character energy. let's go πŸ’…βœ¨

πŸŽ€ NAME πŸŽ€

ata_format_dsm_trim_descr β€” SATL Write Same to DSM Trim ✨

✨ SYNOPSIS ✨

here's the signature, bestie, and yes it's exactly this:

       size_t ata_format_dsm_trim_descr (struct scsi_cmnd *cmd , size_t size ,
       u64 sector , u32 count );

🌸 ARGUMENTS 🌸

  • cmd β€” SCSI command being translated. it's the thing getting the translation glow-up πŸ’–
  • size β€” DSM TRIM payload size in bytes (a multiple of 512). literally a multiple of 512, okay? ✨
  • sector β€” Starting sector. the starting point of the whole saga 🎬
  • count β€” Total Range of request in logical sectors. capital R, official business πŸ‘‘

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so the job is: rewrite the WRITE SAME descriptor to be a DSM TRIM little-endian formatted descriptor. it's giving "same descriptor, new format" and honestly? slay πŸ’…

The payload is a list of size / 8 entries of the format: 63:48 Range Length 47:0 LBA.

Range Length of 0 is ignored. LBA's should be sorted order and not overlap β€” no messy overlapping LBAs, bestie, that's not the vibe 🚫

πŸ’€ NOTE πŸ’€

this is the same format as ADD LBA(S) TO NV CACHE PINNED SET. iykyk ✨

The descriptor is written straight into the WRITE SAME data-out buffer; ata_dsm_trim_pages guarantees size does not exceed that buffer (one logical block). An atomic sg_miter mapping is used so this works from the command submission path and, unlike page_address, copes with a high memory payload. that's the little technical moment and it ate πŸ”₯

🫢 RETURN 🫢

Number of bytes written into the data-out buffer. that's the return, periodt πŸ’–

🌈 SEE ALSO 🌈

Kernel file ./drivers/ata/libata-scsi.c, plus the whole group chat:

xoxo, your kernel bestie πŸ’– β€” from ./drivers/ata, October 2026, ata_format_dsm_trim_descr(9), byeeeeee πŸŽ€

πŸ“¦ where this page comes from