Re: [PATCH] block: Add nr_bios to block_rq_remap tracepoint

2013-09-21 Thread Jens Axboe
On Tue, Sep 17 2013, Jun'ichi Nomura wrote:
> Adding the number of bios in a remapped request to 'block_rq_remap'
> tracepoint.
> 
> Request remapper clones bios in a request to track the completion
> status of each bio. So the number of bios can be useful information
> for investigation.
> 
> Related discussions:
>   http://www.redhat.com/archives/dm-devel/2013-August/msg00084.html
>   http://www.redhat.com/archives/dm-devel/2013-September/msg00024.html
> 
> Signed-off-by: Jun'ichi Nomura 
> Acked-by: Mike Snitzer 
> Cc: Jens Axboe 

Thanks, added.

-- 
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] block: Add nr_bios to block_rq_remap tracepoint

2013-09-21 Thread Jens Axboe
On Tue, Sep 17 2013, Jun'ichi Nomura wrote:
 Adding the number of bios in a remapped request to 'block_rq_remap'
 tracepoint.
 
 Request remapper clones bios in a request to track the completion
 status of each bio. So the number of bios can be useful information
 for investigation.
 
 Related discussions:
   http://www.redhat.com/archives/dm-devel/2013-August/msg00084.html
   http://www.redhat.com/archives/dm-devel/2013-September/msg00024.html
 
 Signed-off-by: Jun'ichi Nomura j-nom...@ce.jp.nec.com
 Acked-by: Mike Snitzer snit...@redhat.com
 Cc: Jens Axboe ax...@kernel.dk

Thanks, added.

-- 
Jens Axboe

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] block: Add nr_bios to block_rq_remap tracepoint

2013-09-17 Thread Jun'ichi Nomura
Adding the number of bios in a remapped request to 'block_rq_remap'
tracepoint.

Request remapper clones bios in a request to track the completion
status of each bio. So the number of bios can be useful information
for investigation.

Related discussions:
  http://www.redhat.com/archives/dm-devel/2013-August/msg00084.html
  http://www.redhat.com/archives/dm-devel/2013-September/msg00024.html

Signed-off-by: Jun'ichi Nomura 
Acked-by: Mike Snitzer 
Cc: Jens Axboe 

diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 2fdb4a4..0e6f765 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -862,6 +862,17 @@ static inline unsigned int blk_rq_get_max_sectors(struct 
request *rq)
return blk_queue_get_max_sectors(q, rq->cmd_flags);
 }
 
+static inline unsigned int blk_rq_count_bios(struct request *rq)
+{
+   unsigned int nr_bios = 0;
+   struct bio *bio;
+
+   __rq_for_each_bio(bio, rq)
+   nr_bios++;
+
+   return nr_bios;
+}
+
 /*
  * Request issue related functions.
  */
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index 60ae7c3..4c2301d 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -618,6 +618,7 @@ TRACE_EVENT(block_rq_remap,
__field( unsigned int,  nr_sector   )
__field( dev_t, old_dev )
__field( sector_t,  old_sector  )
+   __field( unsigned int,  nr_bios )
__array( char,  rwbs,   RWBS_LEN)
),
 
@@ -627,15 +628,16 @@ TRACE_EVENT(block_rq_remap,
__entry->nr_sector  = blk_rq_sectors(rq);
__entry->old_dev= dev;
__entry->old_sector = from;
+   __entry->nr_bios= blk_rq_count_bios(rq);
blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq));
),
 
-   TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
+   TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu %u",
  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
  (unsigned long long)__entry->sector,
  __entry->nr_sector,
  MAJOR(__entry->old_dev), MINOR(__entry->old_dev),
- (unsigned long long)__entry->old_sector)
+ (unsigned long long)__entry->old_sector, __entry->nr_bios)
 );
 
 #endif /* _TRACE_BLOCK_H */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] block: Add nr_bios to block_rq_remap tracepoint

2013-09-17 Thread Jun'ichi Nomura
Adding the number of bios in a remapped request to 'block_rq_remap'
tracepoint.

Request remapper clones bios in a request to track the completion
status of each bio. So the number of bios can be useful information
for investigation.

Related discussions:
  http://www.redhat.com/archives/dm-devel/2013-August/msg00084.html
  http://www.redhat.com/archives/dm-devel/2013-September/msg00024.html

Signed-off-by: Jun'ichi Nomura j-nom...@ce.jp.nec.com
Acked-by: Mike Snitzer snit...@redhat.com
Cc: Jens Axboe ax...@kernel.dk

diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 2fdb4a4..0e6f765 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -862,6 +862,17 @@ static inline unsigned int blk_rq_get_max_sectors(struct 
request *rq)
return blk_queue_get_max_sectors(q, rq-cmd_flags);
 }
 
+static inline unsigned int blk_rq_count_bios(struct request *rq)
+{
+   unsigned int nr_bios = 0;
+   struct bio *bio;
+
+   __rq_for_each_bio(bio, rq)
+   nr_bios++;
+
+   return nr_bios;
+}
+
 /*
  * Request issue related functions.
  */
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index 60ae7c3..4c2301d 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -618,6 +618,7 @@ TRACE_EVENT(block_rq_remap,
__field( unsigned int,  nr_sector   )
__field( dev_t, old_dev )
__field( sector_t,  old_sector  )
+   __field( unsigned int,  nr_bios )
__array( char,  rwbs,   RWBS_LEN)
),
 
@@ -627,15 +628,16 @@ TRACE_EVENT(block_rq_remap,
__entry-nr_sector  = blk_rq_sectors(rq);
__entry-old_dev= dev;
__entry-old_sector = from;
+   __entry-nr_bios= blk_rq_count_bios(rq);
blk_fill_rwbs(__entry-rwbs, rq-cmd_flags, blk_rq_bytes(rq));
),
 
-   TP_printk(%d,%d %s %llu + %u - (%d,%d) %llu,
+   TP_printk(%d,%d %s %llu + %u - (%d,%d) %llu %u,
  MAJOR(__entry-dev), MINOR(__entry-dev), __entry-rwbs,
  (unsigned long long)__entry-sector,
  __entry-nr_sector,
  MAJOR(__entry-old_dev), MINOR(__entry-old_dev),
- (unsigned long long)__entry-old_sector)
+ (unsigned long long)__entry-old_sector, __entry-nr_bios)
 );
 
 #endif /* _TRACE_BLOCK_H */
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/