Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: sd: sd_zbc: Trace zone append emulation

Add tracepoints to the SCSI zone append emulation in order to trace the
zone start to write-pointer aligned LBA translation and the corresponding
completion.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/d103bcf5f90139143469f2a0084c74bd9e03ad4a.1669804487.git.johannes.thumshirn@wdc.com
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Johannes Thumshirn and committed by
Martin K. Petersen
9f5436f4 6456ab5d

+90
+84
drivers/scsi/sd_trace.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * Copyright (C) 2022 Western Digital Corporation or its affiliates. 4 + */ 5 + #undef TRACE_SYSTEM 6 + #define TRACE_SYSTEM sd 7 + 8 + #undef TRACE_INCLUDE_FILE 9 + #define TRACE_INCLUDE_FILE sd_trace 10 + 11 + #if !defined(_SD_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) 12 + #include <scsi/scsi_cmnd.h> 13 + #include <scsi/scsi_host.h> 14 + #include <linux/tracepoint.h> 15 + 16 + TRACE_EVENT(scsi_prepare_zone_append, 17 + 18 + TP_PROTO(struct scsi_cmnd *cmnd, sector_t lba, 19 + unsigned int wp_offset), 20 + 21 + TP_ARGS(cmnd, lba, wp_offset), 22 + 23 + TP_STRUCT__entry( 24 + __field( unsigned int, host_no ) 25 + __field( unsigned int, channel ) 26 + __field( unsigned int, id ) 27 + __field( unsigned int, lun ) 28 + __field( sector_t, lba ) 29 + __field( unsigned int, wp_offset ) 30 + ), 31 + 32 + TP_fast_assign( 33 + __entry->host_no = cmnd->device->host->host_no; 34 + __entry->channel = cmnd->device->channel; 35 + __entry->id = cmnd->device->id; 36 + __entry->lun = cmnd->device->lun; 37 + __entry->lba = lba; 38 + __entry->wp_offset = wp_offset; 39 + ), 40 + 41 + TP_printk("host_no=%u, channel=%u id=%u lun=%u lba=%llu wp_offset=%u", 42 + __entry->host_no, __entry->channel, __entry->id, 43 + __entry->lun, __entry->lba, __entry->wp_offset) 44 + ); 45 + 46 + TRACE_EVENT(scsi_zone_wp_update, 47 + 48 + TP_PROTO(struct scsi_cmnd *cmnd, sector_t rq_sector, 49 + unsigned int wp_offset, unsigned int good_bytes), 50 + 51 + TP_ARGS(cmnd, rq_sector, wp_offset, good_bytes), 52 + 53 + TP_STRUCT__entry( 54 + __field( unsigned int, host_no ) 55 + __field( unsigned int, channel ) 56 + __field( unsigned int, id ) 57 + __field( unsigned int, lun ) 58 + __field( sector_t, rq_sector ) 59 + __field( unsigned int, wp_offset ) 60 + __field( unsigned int, good_bytes ) 61 + ), 62 + 63 + TP_fast_assign( 64 + __entry->host_no = cmnd->device->host->host_no; 65 + __entry->channel = cmnd->device->channel; 66 + __entry->id = cmnd->device->id; 67 + __entry->lun = cmnd->device->lun; 68 + __entry->rq_sector = rq_sector; 69 + __entry->wp_offset = wp_offset; 70 + __entry->good_bytes = good_bytes; 71 + ), 72 + 73 + TP_printk("host_no=%u, channel=%u id=%u lun=%u rq_sector=%llu" \ 74 + " wp_offset=%u good_bytes=%u", 75 + __entry->host_no, __entry->channel, __entry->id, 76 + __entry->lun, __entry->rq_sector, __entry->wp_offset, 77 + __entry->good_bytes) 78 + ); 79 + #endif /* _SD_TRACE_H */ 80 + 81 + /* This part must be outside protection */ 82 + #undef TRACE_INCLUDE_PATH 83 + #define TRACE_INCLUDE_PATH ../../drivers/scsi 84 + #include <trace/define_trace.h>
+6
drivers/scsi/sd_zbc.c
··· 20 20 21 21 #include "sd.h" 22 22 23 + #define CREATE_TRACE_POINTS 24 + #include "sd_trace.h" 25 + 23 26 /** 24 27 * sd_zbc_get_zone_wp_offset - Get zone write pointer offset. 25 28 * @zone: Zone for which to return the write pointer offset. ··· 453 450 break; 454 451 } 455 452 453 + trace_scsi_prepare_zone_append(cmd, *lba, wp_offset); 456 454 *lba += wp_offset; 457 455 } 458 456 spin_unlock_irqrestore(&sdkp->zones_wp_offset_lock, flags); ··· 562 558 563 559 switch (op) { 564 560 case REQ_OP_ZONE_APPEND: 561 + trace_scsi_zone_wp_update(cmd, rq->__sector, 562 + sdkp->zones_wp_offset[zno], good_bytes); 565 563 rq->__sector += sdkp->zones_wp_offset[zno]; 566 564 fallthrough; 567 565 case REQ_OP_WRITE_ZEROES: