From ef18b77adc177f1b7febd396a5be050e0b389eac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 15 Feb 2014 20:50:57 +0100 Subject: [PATCH] trim: added debug output. * Can you give it another try, Alexander? The outcome won't change, I'm afraid, but maybe we'll know some more afterwards. --- src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp | 14 ++++++++++++++ .../kernel/file_systems/bfs/BlockAllocator.cpp | 5 +++++ 2 files changed, 19 insertions(+) diff --git a/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp b/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp index 3fe7997bf0..ece7e70d2a 100644 --- a/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp +++ b/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp @@ -816,6 +816,13 @@ AHCIPort::ScsiUnmap(scsi_ccb* request, scsi_unmap_parameter_list* unmapBlocks) uint32 scsiRangeCount = B_BENDIAN_TO_HOST_INT16( unmapBlocks->block_data_length) / sizeof(scsi_unmap_block_descriptor); +dprintf("TRIM SCSI:\n"); +for (uint32 i = 0; i < scsiRangeCount; i++) { + dprintf("[3%" B_PRIu32 "] %" B_PRIu64 " : %" B_PRIu32 "\n", i, + B_BENDIAN_TO_HOST_INT64(unmapBlocks->blocks[i].lba), + B_BENDIAN_TO_HOST_INT32(unmapBlocks->blocks[i].block_count)); +} + uint32 scsiIndex = 0; uint32 scsiLastBlocks = 0; uint32 maxLBARangeCount = fMaxTrimRangeBlocks * 512 / 8; @@ -886,6 +893,13 @@ AHCIPort::ScsiUnmap(scsi_ccb* request, scsi_unmap_parameter_list* unmapBlocks) } } +dprintf("TRIM AHCI:\n"); +for (uint32 i = 0; i < lbaRangeCount; i++) { + uint64 value = B_HOST_TO_LENDIAN_INT64(lbaRanges[i]); + dprintf("[3%" B_PRIu32 "] %" B_PRIu64 " : %" B_PRIu64 "\n", i, + value >> 48, value & ((uint64)1 << 48) - 1); +} + sata_request sreq; sreq.SetATA48Command(ATA_COMMAND_DATA_SET_MANAGEMENT, 0, (lbaRangesSize + 511) / 512); diff --git a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp index 31dd75380e..77f530fb93 100644 --- a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp +++ b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp @@ -2213,6 +2213,11 @@ BlockAllocator::_TrimNext(fs_trim_data& trimData, uint32 maxRanges, if (!pushed || force) { // Trim now trimData.trimmed_size = 0; +dprintf("TRIM FS:\n"); +for (uint32 i = 0; i < trimData.range_count; i++) { + dprintf("[3%" B_PRIu32 "] %" B_PRIu64 " : %" B_PRIu64 "\n", i, + trimData.ranges[i].offset, trimData.ranges[i].size); +} if (ioctl(fVolume->Device(), B_TRIM_DEVICE, &trimData, sizeof(fs_trim_data)) != 0) { return errno;