Skip to content

Commit

Permalink
null_blk: add trace in null_blk_zoned.c
Browse files Browse the repository at this point in the history
With the help of previously added tracepoints we can now trace
report-zones, zone-write and zone-mgmt ops in null_blk_zoned.c.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
ChaitanayaKulkarni authored and axboe committed Mar 27, 2020
1 parent c51d041 commit 766c329
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion drivers/block/null_blk_zoned.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
#include <linux/vmalloc.h>
#include "null_blk.h"

#define CREATE_TRACE_POINTS
#include "null_blk_trace.h"

/* zone_size in MBs to sectors. */
#define ZONE_SIZE_SHIFT 11

Expand Down Expand Up @@ -80,6 +83,8 @@ int null_report_zones(struct gendisk *disk, sector_t sector,
return 0;

nr_zones = min(nr_zones, dev->nr_zones - first_zone);
trace_nullb_report_zones(nullb, nr_zones);

for (i = 0; i < nr_zones; i++) {
/*
* Stacked DM target drivers will remap the zone information by
Expand Down Expand Up @@ -148,14 +153,17 @@ static blk_status_t null_zone_write(struct nullb_cmd *cmd, sector_t sector,
/* Invalid zone condition */
return BLK_STS_IOERR;
}

trace_nullb_zone_op(cmd, zno, zone->cond);
return BLK_STS_OK;
}

static blk_status_t null_zone_mgmt(struct nullb_cmd *cmd, enum req_opf op,
sector_t sector)
{
struct nullb_device *dev = cmd->nq->dev;
struct blk_zone *zone = &dev->zones[null_zone_no(dev, sector)];
unsigned int zone_no = null_zone_no(dev, sector);
struct blk_zone *zone = &dev->zones[zone_no];
size_t i;

switch (op) {
Expand Down Expand Up @@ -203,6 +211,8 @@ static blk_status_t null_zone_mgmt(struct nullb_cmd *cmd, enum req_opf op,
default:
return BLK_STS_NOTSUPP;
}

trace_nullb_zone_op(cmd, zone_no, zone->cond);
return BLK_STS_OK;
}

Expand Down

0 comments on commit 766c329

Please sign in to comment.