From patchwork Wed Apr 21 20:56:26 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 50676 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 9B69CB6ED0 for ; Thu, 22 Apr 2010 06:56:49 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756527Ab0DUU4s (ORCPT ); Wed, 21 Apr 2010 16:56:48 -0400 Received: from e33.co.us.ibm.com ([32.97.110.151]:34065 "EHLO e33.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755279Ab0DUU4r (ORCPT ); Wed, 21 Apr 2010 16:56:47 -0400 Received: from d03relay05.boulder.ibm.com (d03relay05.boulder.ibm.com [9.17.195.107]) by e33.co.us.ibm.com (8.14.3/8.13.1) with ESMTP id o3LKqqqK012360; Wed, 21 Apr 2010 14:52:52 -0600 Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d03relay05.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o3LKuSNE029112; Wed, 21 Apr 2010 14:56:29 -0600 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o3LDuRhn008833; Wed, 21 Apr 2010 07:56:27 -0600 Received: from tux1.beaverton.ibm.com (elm3a169.beaverton.ibm.com [9.47.66.169]) by d03av03.boulder.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id o3LDuQVL008824; Wed, 21 Apr 2010 07:56:26 -0600 Received: by tux1.beaverton.ibm.com (Postfix, from userid 501) id C576A13E764; Wed, 21 Apr 2010 13:56:26 -0700 (PDT) Date: Wed, 21 Apr 2010 13:56:26 -0700 From: "Darrick J. Wong" To: Jens Axboe Cc: linux-kernel , linux-ext4 Subject: [PATCH] block: Add a trace point whenever a barrier IO request is sent Message-ID: <20100421205626.GA15607@tux1.beaverton.ibm.com> Reply-To: djwong@us.ibm.com MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.17+20080114 (2008-01-14) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Simple debugging patch used to watch for barrier requests. I've been using this to watch ext4's barrier=1 behavior. Signed-off-by: Darrick J. Wong --- block/blk-core.c | 4 ++++ include/trace/events/block.h | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 0 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/block/blk-core.c b/block/blk-core.c index 9fe174d..fe02ea7 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -36,6 +36,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(block_remap); EXPORT_TRACEPOINT_SYMBOL_GPL(block_rq_remap); EXPORT_TRACEPOINT_SYMBOL_GPL(block_bio_complete); +EXPORT_TRACEPOINT_SYMBOL_GPL(block_barrier); static int __make_request(struct request_queue *q, struct bio *bio); @@ -1135,6 +1136,9 @@ void init_request_from_bio(struct request *req, struct bio *bio) if (bio_rw_flagged(bio, BIO_RW_NOIDLE)) req->cmd_flags |= REQ_NOIDLE; + if (req->cmd_flags & (REQ_HARDBARRIER | REQ_SOFTBARRIER)) + trace_block_barrier(req, bio); + req->errors = 0; req->__sector = bio->bi_sector; req->ioprio = bio_prio(bio); diff --git a/include/trace/events/block.h b/include/trace/events/block.h index d870a91..ccf96c3 100644 --- a/include/trace/events/block.h +++ b/include/trace/events/block.h @@ -198,6 +198,41 @@ TRACE_EVENT(block_bio_bounce, ); /** + * block_barrier - barrier operation requested + * @r: request that asked for the barrier + * @bio: block operation + * + * This tracepoint indicates that a barrier operation has been + * requested and a flush will be sent to the underlying block + * device. + */ +TRACE_EVENT(block_barrier, + + TP_PROTO(struct request *r, struct bio *bio), + + TP_ARGS(r, bio), + + TP_STRUCT__entry( + __field( dev_t, dev ) + __field( sector_t, sector ) + __field( unsigned, nr_sector ) + __field( unsigned, cmd_flags ) + ), + + TP_fast_assign( + __entry->dev = bio->bi_bdev->bd_dev; + __entry->sector = bio->bi_sector; + __entry->nr_sector = bio->bi_size >> 9; + __entry->cmd_flags = r->cmd_flags; + ), + + TP_printk("%d:%d %llu + %u [0x%x]", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long long)__entry->sector, + __entry->nr_sector, __entry->cmd_flags) +); + +/** * block_bio_complete - completed all work on the block operation * @q: queue holding the block operation * @bio: block operation completed