ata_dsm_trim_pages(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… ata_dsm_trim_pages(9) β€” the group-chat edition πŸŽ€

okay so bestie, ground rules first: this is a page from the Kernel API Manual, section 9 β€” the kernel API manual, yeah β€” and the star of the show is ata_dsm_trim_pages. pull up a chair, we're about to talk about how many 512-byte pages a TRIM command is allowed to yeet at your device ✨


🌸 NAME 🌸

ata_dsm_trim_pages β€” the max DSM TRIM payload for a device, bestie, measured in 512-byte pages πŸ‘‘


✨ SYNOPSIS ✨

unsigned int ata_dsm_trim_pages (struct ata_device *dev );

that's it. one function, one argument, zero drama. literally iconic.


🫢 ARGUMENTS 🫢

  • dev β€” the ATA device that the DATA SET MANAGEMENT TRIM command is gonna get sent to. that's the one we're sizing the payload for πŸ’…

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so picture this: a DATA SET MANAGEMENT TRIM payload is a list of 512-byte pages, right? and each one of those pages holds up to ATA_MAX_TRIM_RNUM (64) LBA Range Entries. the format is page-based β€” like, structurally page-based β€” and it's got nothing to do with the logical sector size. no cap, they're unrelated 🧚

but β€” and this is the plot twist β€” the logical sector size still bounds it. why? because the descriptor gets written directly into the WRITE SAME data-out buffer, and sd sizes that buffer to a single logical block. so it can hold at most sector_size / 512 pages. that's the ceiling, and it is not negotiable 😭


πŸ’– RETURN πŸ’–

what you get back is the maximum number of 512-byte pages a single translated WRITE SAME command may send to dev. and how's that number decided? it's the smaller of these two cuties:

  • MAX PAGES PER DSM COMMAND β€” that's IDENTIFY DEVICE word 105, but only when the device actually reports a non-zero limit, okay?
  • the logical sector size, expressed in 512-byte pages

and one golden rule: it is never less than one. never. not even for a second 🌈


πŸ‘‘ SEE ALSO πŸ‘‘

the kernel file itself lives at ./drivers/ata/libata-scsi.c β€” go say hi πŸŽ€

and now, the friend group, in the order the manpage introduced them (we do not shuffle the squad):

ata_scsi_set_passthru_sense_fields(9), ata_std_bios_param(9), ata_scsi_unlock_native_capacity(9), ata_get_identity(9), ata_cmd_ioctl(9), ata_task_ioctl(9), ata_scsi_qc_new(9), ata_to_sense_error(9), ata_gen_ata_sense(9), ata_scsi_dma_need_drain(9), ata_scsi_sdev_init(9), ata_scsi_sdev_configure(9), ata_scsi_sdev_destroy(9), ata_scsi_start_stop_xlat(9), ata_scsi_flush_xlat(9), scsi_6_lba_len(9), scsi_10_lba_len(9), scsi_16_lba_len(9), scsi_dld(9), ata_scsi_verify_xlat(9), ata_scsi_rw_xlat(9), ata_scsi_translate(9), ata_scsi_rbuf_fill(9), ata_scsiop_inq_std(9), ata_scsiop_inq_00(9), ata_scsiop_inq_80(9), ata_scsiop_inq_83(9), ata_scsiop_inq_89(9), ata_scsiop_inq_b0(9), ata_scsiop_inq_b1(9), ata_scsiop_inq_b2(9), ata_scsiop_inq_b6(9), ata_scsiop_inq_b9(9), ata_scsiop_inquiry(9), modecpy(9), ata_msense_caching(9), ata_msense_control(9), ata_msense_rw_recovery(9), ata_scsiop_mode_sense(9), ata_scsiop_read_cap(9), ata_scsiop_report_luns(9), atapi_xlat(9), ata_scsi_find_dev(9), ata_scsi_pass_thru(9), ata_format_dsm_trim_descr(9), ata_scsi_write_same_xlat(9), ata_scsiop_maint_in(9), ata_scsi_report_zones_complete(9), ata_mselect_caching(9), ata_mselect_control(9), ata_scsi_mode_select_xlat(9), ata_scsi_var_len_cdb_xlat(9), ata_get_xlat_func(9), ata_scsi_simulate(9), ata_scsi_queuecmd(9), ata_scsi_offline_dev(9), ata_scsi_remove_dev(9), ata_scsi_media_change_notify(9), ata_scsi_hotplug(9), ata_scsi_user_scan(9), ata_scsi_dev_rescan(9)

like, that is a whole friend group and every single one of them made the list. no one left behind πŸ’œ

ngl if you were looking for the deep lore, ata_format_dsm_trim_descr(9) and ata_scsi_write_same_xlat(9) are the ones actually doing the descriptor-building and the translation, so start there bestie πŸ”₯

and that's the whole page!! this one came out of ./drivers/ata in October 2026, and it's filed under ata_dsm_trim_pages(9) β€” so if you're citing it, cite it cute 🌸 mwah, go trim responsibly πŸ’…βœ¨

πŸ“¦ where this page comes from