From patchwork Wed Nov 28 03:49:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 10701815 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2F29114E2 for ; Wed, 28 Nov 2018 03:53:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 208802CD7A for ; Wed, 28 Nov 2018 03:53:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 14A482CD70; Wed, 28 Nov 2018 03:53:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE7DE2CD49 for ; Wed, 28 Nov 2018 03:53:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727019AbeK1Owk (ORCPT ); Wed, 28 Nov 2018 09:52:40 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:50934 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726847AbeK1Owk (ORCPT ); Wed, 28 Nov 2018 09:52:40 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wAS3mp2q033441; Wed, 28 Nov 2018 03:52:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=BJnmFYQQlGRu/5A4+zMVKg4kh2H7+FpVmnF4JYWo4q4=; b=wkK785TJDZl3d3oYaFCYpE0DxZz8WoqFzGoHUH2P2KEUVnsPz9EREcaPfrtpW40WP5lE QlTjVLAHueQfS9uTXIzE0sYc3G/ahSdKC0AF49h3qgTfbDJ8KxtZ3P0tfy9HevGPsI3H 51/tKC5/TBmWO4R+7nPRn2KthnJWthLoMbgRK6iD0hGCpsZnZz2KMFaJOxzKF4XMm5S+ iiS7cJgt+cc+y7d0pc5YPqxTgpzZkK+YBfgsc3q98yArG2SmBk1Ir6aZ3f5+NjEBXrqL 13nJVEnWO2rhl88DB5fnq8QNKU5BBCF3WltBa7WDdwR1hV43ImN5CwsgGejtENWyyKNg 6A== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2130.oracle.com with ESMTP id 2nxx2u7tkm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Nov 2018 03:52:31 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id wAS3qU2Q018655 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Nov 2018 03:52:30 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id wAS3qUt4005857; Wed, 28 Nov 2018 03:52:30 GMT Received: from localhost.localdomain (/70.176.225.12) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 27 Nov 2018 19:52:30 -0800 From: Allison Henderson To: linux-block@vger.kernel.org, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: martin.petersen@oracle.com, shirley.ma@oracle.com, bob.liu@oracle.com, allison.henderson@oracle.com Subject: [PATCH v1 1/7] block: add nr_mirrors to request_queue Date: Tue, 27 Nov 2018 20:49:45 -0700 Message-Id: <1543376991-5764-2-git-send-email-allison.henderson@oracle.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543376991-5764-1-git-send-email-allison.henderson@oracle.com> References: <1543376991-5764-1-git-send-email-allison.henderson@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9090 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811280033 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bob Liu When fs data/metadata checksum mismatch, lower block devices may have other correct copies. e.g if we did raid1 for protecting fs metadata. Then fs could try other copies of metadata instead of panic, but fs need be awared how many mirrors the block devices have and specify which mirror/copy to retry. This patch add @nr_mirrors to struct request_queue which is similar as blk_queue_nonrot(), filesystem can grab device request queue and check the number of mirrors of this block device. @nr_mirrors is 0 by default which means no mirrors, drivers e.g raid1 are responsible for setting the right value. Also added helper functions for get/set the number of mirrors for a specific device request queue. Todo: * Export nr_mirrors through /sysfs. Signed-off-by: Bob Liu --- block/blk-core.c | 3 +++ block/blk-settings.c | 18 ++++++++++++++++++ include/linux/blkdev.h | 3 +++ 3 files changed, 24 insertions(+) diff --git a/block/blk-core.c b/block/blk-core.c index ce12515f..50779c8 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -1082,6 +1082,9 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id, if (blkcg_init_queue(q)) goto fail_ref; + /* Set queue default mirrors to 0 explicitly. */ + blk_queue_set_mirrors(q, 0); + return q; fail_ref: diff --git a/block/blk-settings.c b/block/blk-settings.c index 696c04c..6f4f9c7 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -904,6 +904,24 @@ void blk_queue_write_cache(struct request_queue *q, bool wc, bool fua) } EXPORT_SYMBOL_GPL(blk_queue_write_cache); +/* + * Get the number of read redundant mirrors. + */ +unsigned short blk_queue_get_mirrors(struct request_queue *q) +{ + return q->nr_mirrors; +} +EXPORT_SYMBOL(blk_queue_get_mirrors); + +/* + * Set the number of read redundant mirrors. + */ +void blk_queue_set_mirrors(struct request_queue *q, unsigned short mirrors) +{ + q->nr_mirrors = mirrors; +} +EXPORT_SYMBOL(blk_queue_set_mirrors); + static int __init blk_settings_init(void) { blk_max_low_pfn = max_low_pfn - 1; diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 4293dc1..fac35da 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -680,6 +680,7 @@ struct request_queue { #define BLK_MAX_WRITE_HINTS 5 u64 write_hints[BLK_MAX_WRITE_HINTS]; + unsigned short nr_mirrors; /* Default value is zero */ }; #define QUEUE_FLAG_QUEUED 0 /* uses generic tag queueing */ @@ -1267,6 +1268,8 @@ extern void blk_queue_rq_timed_out(struct request_queue *, rq_timed_out_fn *); extern void blk_queue_rq_timeout(struct request_queue *, unsigned int); extern void blk_queue_flush_queueable(struct request_queue *q, bool queueable); extern void blk_queue_write_cache(struct request_queue *q, bool enabled, bool fua); +extern unsigned short blk_queue_get_mirrors(struct request_queue *q); +extern void blk_queue_set_mirrors(struct request_queue *q, unsigned short mirrors); /* * Number of physical segments as sent to the device. From patchwork Wed Nov 28 03:49:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 10701807 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A7B1B13AD for ; Wed, 28 Nov 2018 03:53:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 998072CC8C for ; Wed, 28 Nov 2018 03:53:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8CEBF2CD6E; Wed, 28 Nov 2018 03:53:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E4462CC8C for ; Wed, 28 Nov 2018 03:53:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727312AbeK1Own (ORCPT ); Wed, 28 Nov 2018 09:52:43 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:50952 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726894AbeK1Owl (ORCPT ); Wed, 28 Nov 2018 09:52:41 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wAS3mvgn033460; Wed, 28 Nov 2018 03:52:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=R+UtGVOKFVNWqiM4bqMY+TBoSWEDEIFkBqU6+nTj/Fk=; b=jTSKun2+huZowX5qz3mc6uwZDWBcmvTAx7uHxxuBXgudK850C6i/bz8Aoz5Y88IIeT9z tWnxhyWoM0Gf3Hol+DBevNDGLCrIiCtsqX9jyAmpNuKAMsO3AIYLyqszQesBjIw7ZlMB ywkzCDQk277VuGU/bO+lGF21rTIsQKJzQCXA3U1gLTfJ/GSjdXoknu24zRspyCmjDw+9 zJ6JKC7hNH/AWZzd/ynyoImDBeGL7UAZSV8QeFYnX2//k4RgcUTaEWWawv4rchCEYr9A yeGHJfi+UO3xGSc2UODegIaoqE7g6Iu5a1jADBjKsnafHBsodZOUw6voGr8dDQahPCh6 jw== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2nxx2u7tkt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Nov 2018 03:52:32 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id wAS3qWKT026396 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Nov 2018 03:52:32 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id wAS3qVoQ028891; Wed, 28 Nov 2018 03:52:32 GMT Received: from localhost.localdomain (/70.176.225.12) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 27 Nov 2018 19:52:31 -0800 From: Allison Henderson To: linux-block@vger.kernel.org, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: martin.petersen@oracle.com, shirley.ma@oracle.com, bob.liu@oracle.com, allison.henderson@oracle.com Subject: [PATCH v1 2/7] block: expand write_hint of bio/request to rw_hint Date: Tue, 27 Nov 2018 20:49:46 -0700 Message-Id: <1543376991-5764-3-git-send-email-allison.henderson@oracle.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543376991-5764-1-git-send-email-allison.henderson@oracle.com> References: <1543376991-5764-1-git-send-email-allison.henderson@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9090 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811280033 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bob Liu Write_hint was expanded to rw_hint in order to to alternative mirror device retry. * Renaming @bi_write_hint in 'struct bio' to @bi_rw_hint, and @write_hint in 'struct request' to @rw_hint. * Making @bi_rw_hint only be updated for WRITE IO. It isn't a problem before because READ didn't use this hint at all. * Setting @bi_rw_hint to specify which mirror to read from by force. * Recording which mirror i/o really went to. This is because lower layer e.g MD/radi1 driver may have optimization to spread i/o on different copies, Upper layer e.g fs doesn't have idea data was reading from which device/mirror, so as can not start retry. Todo: - Eat no more than 3-4 of the hint bits since most devices won't have more than 8-16 mirrors. Signed-off-by: Bob Liu --- Documentation/block/biodoc.txt | 7 +++++++ block/bio.c | 2 +- block/blk-core.c | 10 +++++++++- block/blk-merge.c | 8 ++++---- block/bounce.c | 2 +- drivers/md/raid1.c | 2 +- drivers/md/raid5.c | 10 +++++----- drivers/md/raid5.h | 2 +- drivers/nvme/host/core.c | 2 +- fs/block_dev.c | 6 ++++-- fs/btrfs/extent_io.c | 3 ++- fs/buffer.c | 3 ++- fs/direct-io.c | 3 ++- fs/ext4/page-io.c | 7 +++++-- fs/f2fs/data.c | 2 +- fs/iomap.c | 3 ++- fs/mpage.c | 2 +- fs/xfs/xfs_aops.c | 4 ++-- include/linux/blk_types.h | 2 +- include/linux/blkdev.h | 2 +- 20 files changed, 53 insertions(+), 29 deletions(-) diff --git a/Documentation/block/biodoc.txt b/Documentation/block/biodoc.txt index 207eca5..65cda9e 100644 --- a/Documentation/block/biodoc.txt +++ b/Documentation/block/biodoc.txt @@ -431,6 +431,7 @@ struct bio { struct bio *bi_next; /* request queue link */ struct block_device *bi_bdev; /* target device */ unsigned long bi_flags; /* status, command, etc */ + unsigned short bi_rw_hint; /* bio read/write hint */ unsigned long bi_opf; /* low bits: r/w, high: priority */ unsigned int bi_vcnt; /* how may bio_vec's */ @@ -465,6 +466,12 @@ With this multipage bio design: (e.g a 1MB bio_vec needs to be handled in max 128kB chunks for IDE) [TBD: Should preferably also have a bi_voffset and bi_vlen to avoid modifying bi_offset an len fields] +- bi_rw_hint is an in/out parameter. Fs can set bi_rw_hint in submit_bio() to + specify which mirror/copy to read from by force. Zero is a special value + means fs don't care about reading from which mirror/copy. Starting from 1 + means to read from the 'bi_rw_hint-1' mirror mandatory. + bi_rw_hint was set to indicate which mirror this i/o was really + happened on completion. (*) unrelated merges -- a request ends up containing two or more bios that didn't originate from the same place. diff --git a/block/bio.c b/block/bio.c index d5368a4..25f1b22 100644 --- a/block/bio.c +++ b/block/bio.c @@ -605,7 +605,7 @@ void __bio_clone_fast(struct bio *bio, struct bio *bio_src) if (bio_flagged(bio_src, BIO_THROTTLED)) bio_set_flag(bio, BIO_THROTTLED); bio->bi_opf = bio_src->bi_opf; - bio->bi_write_hint = bio_src->bi_write_hint; + bio->bi_rw_hint = bio_src->bi_rw_hint; bio->bi_iter = bio_src->bi_iter; bio->bi_io_vec = bio_src->bi_io_vec; diff --git a/block/blk-core.c b/block/blk-core.c index 50779c8..e9f7080 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -1980,7 +1980,7 @@ void blk_init_request_from_bio(struct request *req, struct bio *bio) req->ioprio = ioc->ioprio; else req->ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, 0); - req->write_hint = bio->bi_write_hint; + req->rw_hint = bio->bi_rw_hint; blk_rq_bio_prep(req->q, req, bio); } EXPORT_SYMBOL_GPL(blk_init_request_from_bio); @@ -2314,6 +2314,14 @@ generic_make_request_checks(struct bio *bio) if (!q->limits.max_write_zeroes_sectors) goto not_supported; break; + /* + * Zero is special value which means upper layer e.g fs don't care + * about reading from which mirror. + * Starting from 1 means reading from mirror 'bi_rw_hint-1' mandatory. + */ + case REQ_OP_READ: + if (bio->bi_rw_hint < 0 || bio->bi_rw_hint > q->nr_mirrors) + goto not_supported; default: break; } diff --git a/block/blk-merge.c b/block/blk-merge.c index 6b5ad27..e32e2d2 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -766,10 +766,10 @@ static struct request *attempt_merge(struct request_queue *q, return NULL; /* - * Don't allow merge of different write hints, or for a hint with + * Don't allow merge of different rw hints, or for a hint with * non-hint IO. */ - if (req->write_hint != next->write_hint) + if (req->rw_hint != next->rw_hint) return NULL; /* @@ -904,10 +904,10 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio) return false; /* - * Don't allow merge of different write hints, or for a hint with + * Don't allow merge of different rw hints, or for a hint with * non-hint IO. */ - if (rq->write_hint != bio->bi_write_hint) + if (rq->rw_hint != bio->bi_rw_hint) return false; return true; diff --git a/block/bounce.c b/block/bounce.c index 36869af..a7b789e 100644 --- a/block/bounce.c +++ b/block/bounce.c @@ -248,7 +248,7 @@ static struct bio *bounce_clone_bio(struct bio *bio_src, gfp_t gfp_mask, return NULL; bio->bi_disk = bio_src->bi_disk; bio->bi_opf = bio_src->bi_opf; - bio->bi_write_hint = bio_src->bi_write_hint; + bio->bi_rw_hint = bio_src->bi_rw_hint; bio->bi_iter.bi_sector = bio_src->bi_iter.bi_sector; bio->bi_iter.bi_size = bio_src->bi_iter.bi_size; diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 1d54109..fedf8c0 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -1102,7 +1102,7 @@ static void alloc_behind_master_bio(struct r1bio *r1_bio, goto skip_copy; } - behind_bio->bi_write_hint = bio->bi_write_hint; + behind_bio->bi_rw_hint = bio->bi_rw_hint; while (i < vcnt && size) { struct page *page; diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 4990f03..37593a0 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -1137,9 +1137,9 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) bi->bi_io_vec[0].bv_len = STRIPE_SIZE; bi->bi_io_vec[0].bv_offset = 0; bi->bi_iter.bi_size = STRIPE_SIZE; - bi->bi_write_hint = sh->dev[i].write_hint; + bi->bi_rw_hint = sh->dev[i].rw_hint; if (!rrdev) - sh->dev[i].write_hint = RWF_WRITE_LIFE_NOT_SET; + sh->dev[i].rw_hint = RWF_WRITE_LIFE_NOT_SET; /* * If this is discard request, set bi_vcnt 0. We don't * want to confuse SCSI because SCSI will replace payload @@ -1191,8 +1191,8 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) rbi->bi_io_vec[0].bv_len = STRIPE_SIZE; rbi->bi_io_vec[0].bv_offset = 0; rbi->bi_iter.bi_size = STRIPE_SIZE; - rbi->bi_write_hint = sh->dev[i].write_hint; - sh->dev[i].write_hint = RWF_WRITE_LIFE_NOT_SET; + rbi->bi_rw_hint = sh->dev[i].rw_hint; + sh->dev[i].rw_hint = RWF_WRITE_LIFE_NOT_SET; /* * If this is discard request, set bi_vcnt 0. We don't * want to confuse SCSI because SCSI will replace payload @@ -3219,7 +3219,7 @@ static int add_stripe_bio(struct stripe_head *sh, struct bio *bi, int dd_idx, (unsigned long long)sh->sector); spin_lock_irq(&sh->stripe_lock); - sh->dev[dd_idx].write_hint = bi->bi_write_hint; + sh->dev[dd_idx].rw_hint = bi->bi_rw_hint; /* Don't allow new IO added to stripes in batch list */ if (sh->batch_head) goto overlap; diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h index 8474c22..e9f0794 100644 --- a/drivers/md/raid5.h +++ b/drivers/md/raid5.h @@ -257,7 +257,7 @@ struct stripe_head { sector_t sector; /* sector of this page */ unsigned long flags; u32 log_checksum; - unsigned short write_hint; + unsigned short rw_hint; } dev[1]; /* allocated with extra space depending of RAID geometry */ }; diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 2e65be8..18f0824 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -516,7 +516,7 @@ static void nvme_assign_write_stream(struct nvme_ctrl *ctrl, struct request *req, u16 *control, u32 *dsmgmt) { - enum rw_hint streamid = req->write_hint; + enum rw_hint streamid = req->rw_hint; if (streamid == WRITE_LIFE_NOT_SET || streamid == WRITE_LIFE_NONE) streamid = 0; diff --git a/fs/block_dev.c b/fs/block_dev.c index a80b4f0..cd6e154 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -214,7 +214,8 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter, bio_init(&bio, vecs, nr_pages); bio_set_dev(&bio, bdev); bio.bi_iter.bi_sector = pos >> 9; - bio.bi_write_hint = iocb->ki_hint; + if (iov_iter_rw(iter) == WRITE) + bio.bi_rw_hint = iocb->ki_hint; bio.bi_private = current; bio.bi_end_io = blkdev_bio_end_io_simple; bio.bi_ioprio = iocb->ki_ioprio; @@ -355,7 +356,8 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages) for (;;) { bio_set_dev(bio, bdev); bio->bi_iter.bi_sector = pos >> 9; - bio->bi_write_hint = iocb->ki_hint; + if (!is_read) + bio->bi_rw_hint = iocb->ki_hint; bio->bi_private = dio; bio->bi_end_io = blkdev_bio_end_io; bio->bi_ioprio = iocb->ki_ioprio; diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index d228f70..3a9525e 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -2806,7 +2806,8 @@ static int submit_extent_page(unsigned int opf, struct extent_io_tree *tree, bio_add_page(bio, page, page_size, pg_offset); bio->bi_end_io = end_io_func; bio->bi_private = tree; - bio->bi_write_hint = page->mapping->host->i_write_hint; + if (opf & REQ_OP_WRITE) + bio->bi_rw_hint = page->mapping->host->i_write_hint; bio->bi_opf = opf; if (wbc) { wbc_init_bio(wbc, bio); diff --git a/fs/buffer.c b/fs/buffer.c index 1286c2b..2959055 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -3067,7 +3067,8 @@ static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh, bio->bi_iter.bi_sector = bh->b_blocknr * (bh->b_size >> 9); bio_set_dev(bio, bh->b_bdev); - bio->bi_write_hint = write_hint; + if (REQ_OP_WRITE & op) + bio->bi_rw_hint = write_hint; bio_add_page(bio, bh->b_page, bh->b_size, bh_offset(bh)); BUG_ON(bio->bi_iter.bi_size != bh->b_size); diff --git a/fs/direct-io.c b/fs/direct-io.c index 722d17c..290b29e 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c @@ -445,7 +445,8 @@ dio_bio_alloc(struct dio *dio, struct dio_submit *sdio, else bio->bi_end_io = dio_bio_end_io; - bio->bi_write_hint = dio->iocb->ki_hint; + if (dio->op == REQ_OP_WRITE) + bio->bi_rw_hint = dio->iocb->ki_hint; sdio->bio = bio; sdio->logical_offset_in_bio = sdio->cur_page_fs_offset; diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c index db75901..8d63174 100644 --- a/fs/ext4/page-io.c +++ b/fs/ext4/page-io.c @@ -351,7 +351,9 @@ void ext4_io_submit(struct ext4_io_submit *io) if (bio) { int io_op_flags = io->io_wbc->sync_mode == WB_SYNC_ALL ? REQ_SYNC : 0; - io->io_bio->bi_write_hint = io->io_end->inode->i_write_hint; + if (io->io_bio->bi_opf & REQ_OP_WRITE) + io->io_bio->bi_rw_hint = + io->io_end->inode->i_write_hint; bio_set_op_attrs(io->io_bio, REQ_OP_WRITE, io_op_flags); submit_bio(io->io_bio); } @@ -399,7 +401,8 @@ static int io_submit_add_bh(struct ext4_io_submit *io, ret = io_submit_init_bio(io, bh); if (ret) return ret; - io->io_bio->bi_write_hint = inode->i_write_hint; + if (io->io_bio->bi_opf & REQ_OP_WRITE) + io->io_bio->bi_rw_hint = inode->i_write_hint; } ret = bio_add_page(io->io_bio, page, bh->b_size, bh_offset(bh)); if (ret != bh->b_size) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index b293cb3..5f9afa2 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -269,7 +269,7 @@ static struct bio *__bio_alloc(struct f2fs_sb_info *sbi, block_t blk_addr, } else { bio->bi_end_io = f2fs_write_end_io; bio->bi_private = sbi; - bio->bi_write_hint = f2fs_io_type_to_rw_hint(sbi, type, temp); + bio->bi_rw_hint = f2fs_io_type_to_rw_hint(sbi, type, temp); } if (wbc) wbc_init_bio(wbc, bio); diff --git a/fs/iomap.c b/fs/iomap.c index 64ce240..8115475 100644 --- a/fs/iomap.c +++ b/fs/iomap.c @@ -1637,7 +1637,8 @@ iomap_dio_bio_actor(struct inode *inode, loff_t pos, loff_t length, bio = bio_alloc(GFP_KERNEL, nr_pages); bio_set_dev(bio, iomap->bdev); bio->bi_iter.bi_sector = iomap_sector(iomap, pos); - bio->bi_write_hint = dio->iocb->ki_hint; + if (dio->flags & IOMAP_DIO_WRITE) + bio->bi_rw_hint = dio->iocb->ki_hint; bio->bi_ioprio = dio->iocb->ki_ioprio; bio->bi_private = dio; bio->bi_end_io = iomap_dio_bio_end_io; diff --git a/fs/mpage.c b/fs/mpage.c index c820dc9..fd70ba7 100644 --- a/fs/mpage.c +++ b/fs/mpage.c @@ -639,7 +639,7 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc, goto confused; wbc_init_bio(wbc, bio); - bio->bi_write_hint = inode->i_write_hint; + bio->bi_rw_hint = inode->i_write_hint; } /* diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 338b9d9..6dafcec 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c @@ -523,7 +523,7 @@ xfs_submit_ioend( return status; } - ioend->io_bio->bi_write_hint = ioend->io_inode->i_write_hint; + ioend->io_bio->bi_rw_hint = ioend->io_inode->i_write_hint; submit_bio(ioend->io_bio); return 0; } @@ -577,7 +577,7 @@ xfs_chain_bio( bio_chain(ioend->io_bio, new); bio_get(ioend->io_bio); /* for xfs_destroy_ioend */ ioend->io_bio->bi_opf = REQ_OP_WRITE | wbc_to_write_flags(wbc); - ioend->io_bio->bi_write_hint = ioend->io_inode->i_write_hint; + ioend->io_bio->bi_rw_hint = ioend->io_inode->i_write_hint; submit_bio(ioend->io_bio); ioend->io_bio = new; } diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index 1dcf652..612e8a6 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -150,7 +150,7 @@ struct bio { */ unsigned short bi_flags; /* status, etc and bvec pool number */ unsigned short bi_ioprio; - unsigned short bi_write_hint; + unsigned short bi_rw_hint; blk_status_t bi_status; u8 bi_partno; diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index fac35da..02179af 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -234,7 +234,7 @@ struct request { unsigned short nr_integrity_segments; #endif - unsigned short write_hint; + unsigned short rw_hint; unsigned short ioprio; void *special; /* opaque pointer available for LLD use */ From patchwork Wed Nov 28 03:49:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 10701811 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E4BDB14E2 for ; Wed, 28 Nov 2018 03:53:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7A452CD5F for ; Wed, 28 Nov 2018 03:53:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB5AC2CCE9; Wed, 28 Nov 2018 03:53:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 739AB2CC8C for ; Wed, 28 Nov 2018 03:53:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727302AbeK1Owm (ORCPT ); Wed, 28 Nov 2018 09:52:42 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:49868 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726847AbeK1Owl (ORCPT ); Wed, 28 Nov 2018 09:52:41 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wAS3n7cD189030; Wed, 28 Nov 2018 03:52:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=BGxfOtbnwbxoSi86gUIBC5QMn8k64hISnYOpB7SmpVE=; b=jjJqDbxQ5S1OgAErXyJi3ukv7lpyF3jBLnHzYjpQ2IJBC4G8KRyy4eG7DvGsI8eOosL+ IjxA+10xGpEid2GI3zpCTRCXd+QRrQZPrqIb9jIevTbAjMwxwcCC1aoWWQN8YoIlZHZz 25uEKFvyYiTgun23m22MLa3EYawAMrJic/QZsK+H3UeY47QnN/RW5UuGzQKOXdPCgXtr /Du4RiE+VMA6UWJLOlKydW/cuRf5SLd0tZbmVFKOGo222q8dawus8wFqZvid8ME6deQ8 R5oUFTtB2fpVYxd69m1j3+bt4Lw1+zB3b2JW1w3shdsc3ni86dKpx6UBHijJwnFGWzAG cw== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2nxy9r7rb9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Nov 2018 03:52:33 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id wAS3qWPu018742 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Nov 2018 03:52:32 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id wAS3qWAu005861; Wed, 28 Nov 2018 03:52:32 GMT Received: from localhost.localdomain (/70.176.225.12) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 27 Nov 2018 19:52:32 -0800 From: Allison Henderson To: linux-block@vger.kernel.org, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: martin.petersen@oracle.com, shirley.ma@oracle.com, bob.liu@oracle.com, allison.henderson@oracle.com Subject: [PATCH v1 3/7] md: raid1: handle bi_rw_hint accordingly Date: Tue, 27 Nov 2018 20:49:47 -0700 Message-Id: <1543376991-5764-4-git-send-email-allison.henderson@oracle.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543376991-5764-1-git-send-email-allison.henderson@oracle.com> References: <1543376991-5764-1-git-send-email-allison.henderson@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9090 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811280033 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bob Liu * nr_mirrors that raid1 device support should be @raid_disks, init it properly. * Recording i/o went to which mirror in bio->bi_rw_hint. * Read from specific real device if bi_rw_hint was set. Todo: * Support more drivers. Signed-off-by: Bob Liu --- drivers/md/raid1.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index fedf8c0..d2bdd0e 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -553,7 +553,8 @@ static sector_t align_to_barrier_unit_end(sector_t start_sector, * * The rdev for the device selected will have nr_pending incremented. */ -static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sectors) +static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sectors, + unsigned short disk_hint) { const sector_t this_sector = r1_bio->sector; int sectors; @@ -566,6 +567,7 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect struct md_rdev *rdev; int choose_first; int choose_next_idle; + int max_disks; rcu_read_lock(); /* @@ -593,7 +595,20 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect else choose_first = 0; - for (disk = 0 ; disk < conf->raid_disks * 2 ; disk++) { + if (disk_hint) { + disk = disk_hint - 1; + /* + * Consider replacement as a special case, use original device to + * indicate which mirror this i/o was happened. + */ + if (disk >= conf->raid_disks) + disk -= conf->raid_disks; + max_disks = disk + 1; + } else { + disk = 0; + max_disks = conf->raid_disks * 2; + } + for (; disk < max_disks; disk++) { sector_t dist; sector_t first_bad; int bad_sectors; @@ -1234,7 +1249,7 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio, * make_request() can abort the operation when read-ahead is being * used and no empty request is available. */ - rdisk = read_balance(conf, r1_bio, &max_sectors); + rdisk = read_balance(conf, r1_bio, &max_sectors, bio->bi_rw_hint); if (rdisk < 0) { /* couldn't find anywhere to read from */ @@ -1247,6 +1262,10 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio, raid_end_bio_io(r1_bio); return; } + + /* Recording i/o went to which real device. */ + bio->bi_rw_hint = rdisk; + mirror = conf->mirrors + rdisk; if (print_msg) @@ -1279,6 +1298,11 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio, r1_bio->read_disk = rdisk; read_bio = bio_clone_fast(bio, gfp, &mddev->bio_set); + /* + * Clear bi_rw_hint, because it was set last i/o went to which real + * device. + */ + read_bio->bi_rw_hint = 0; r1_bio->bios[rdisk] = read_bio; @@ -3078,6 +3102,7 @@ static int raid1_run(struct mddev *mddev) if (mddev->queue) { blk_queue_max_write_same_sectors(mddev->queue, 0); blk_queue_max_write_zeroes_sectors(mddev->queue, 0); + blk_queue_set_mirrors(mddev->queue, mddev->raid_disks); } rdev_for_each(rdev, mddev) { From patchwork Wed Nov 28 03:49:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 10701795 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9D67713AD for ; Wed, 28 Nov 2018 03:53:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8DEE92CC5F for ; Wed, 28 Nov 2018 03:53:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81C1A2CCE9; Wed, 28 Nov 2018 03:53:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B6842CC70 for ; Wed, 28 Nov 2018 03:53:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727347AbeK1Own (ORCPT ); Wed, 28 Nov 2018 09:52:43 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:49874 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727275AbeK1Own (ORCPT ); Wed, 28 Nov 2018 09:52:43 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wAS3o1VB189539; Wed, 28 Nov 2018 03:52:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=yD5x9hILqKnXnR+iJkaVfDAkoFG33aIC5PnQ9piiAJw=; b=GxV8qlGol1acBowmlfmmJnaodJXalW/XQY9QmNQhkoISHwxVd+Hc2s1xw+mQw0wDwc32 fHJHACGP/A2dA/VGrLLBnzXaDSbwEPooYklOXfuHwSDcVaF4AQHfgrHHyDN08MBC3ejy Ko56/rtvf+RDy51IfJ1diwTTPEci3/fIT0mYc9UlzGl0rxo2OHFDR5Zd/F4s52IOIyro 6j+JOq0umz4/dnAfYkEzUXRmyckZQyC6QAQctr0tihFkVXtH24Ph0AVnp0X2l4G35UUq D5DAo4ORaFcIJoTWMetua17WLDhIoop7lT+vKtjmI0gE9XbHULDomXhpyT7M5ZaLmIuB fA== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2nxy9r7rbc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Nov 2018 03:52:34 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id wAS3qY1q026429 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Nov 2018 03:52:34 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id wAS3qYjd023554; Wed, 28 Nov 2018 03:52:34 GMT Received: from localhost.localdomain (/70.176.225.12) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 27 Nov 2018 19:52:33 -0800 From: Allison Henderson To: linux-block@vger.kernel.org, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: martin.petersen@oracle.com, shirley.ma@oracle.com, bob.liu@oracle.com, allison.henderson@oracle.com Subject: [PATCH v1 4/7] xfs: Add b_rw_hint to xfs_buf Date: Tue, 27 Nov 2018 20:49:48 -0700 Message-Id: <1543376991-5764-5-git-send-email-allison.henderson@oracle.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543376991-5764-1-git-send-email-allison.henderson@oracle.com> References: <1543376991-5764-1-git-send-email-allison.henderson@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9090 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=915 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811280033 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds a new field b_rw_hint to xfs_buf. We will need this to properly initialize the new bio->bi_rw_hint when submitting the read request. When the read completes, we then store the returned mirror in the b_rw_hint. Signed-off-by: Allison Henderson --- fs/xfs/xfs_buf.c | 5 ++++- fs/xfs/xfs_buf.h | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index b21ea2b..dd8ba59 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -1322,8 +1322,10 @@ xfs_buf_bio_end_io( if (!bp->b_error && xfs_buf_is_vmapped(bp) && (bp->b_flags & XBF_READ)) invalidate_kernel_vmap_range(bp->b_addr, xfs_buf_vmap_len(bp)); - if (atomic_dec_and_test(&bp->b_io_remaining) == 1) + if (atomic_dec_and_test(&bp->b_io_remaining) == 1) { + bp->b_rw_hint = bio->bi_rw_hint; xfs_buf_ioend_async(bp); + } bio_put(bio); } @@ -1369,6 +1371,7 @@ xfs_buf_ioapply_map( bio->bi_iter.bi_sector = sector; bio->bi_end_io = xfs_buf_bio_end_io; bio->bi_private = bp; + bio->bi_rw_hint = bp->b_rw_hint; bio_set_op_attrs(bio, op, op_flags); for (; size && nr_pages; nr_pages--, page_index++) { diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h index b9f5511..db138e5 100644 --- a/fs/xfs/xfs_buf.h +++ b/fs/xfs/xfs_buf.h @@ -197,6 +197,13 @@ typedef struct xfs_buf { unsigned long b_first_retry_time; /* in jiffies */ int b_last_error; + /* + * If b_rw_hint is set before a read, it specifies an alternate mirror + * to read from. Upon bio completion, b_rw_hint stores the last mirror + * that was read from + */ + unsigned short b_rw_hint; + const struct xfs_buf_ops *b_ops; } xfs_buf_t; From patchwork Wed Nov 28 03:49:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 10701785 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0066114BD for ; Wed, 28 Nov 2018 03:52:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E6D4D2CD5F for ; Wed, 28 Nov 2018 03:52:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA4782CCE5; Wed, 28 Nov 2018 03:52:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8FBB12CD5F for ; Wed, 28 Nov 2018 03:52:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727420AbeK1Owp (ORCPT ); Wed, 28 Nov 2018 09:52:45 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:52266 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726894AbeK1Owo (ORCPT ); Wed, 28 Nov 2018 09:52:44 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wAS3mX89192793; Wed, 28 Nov 2018 03:52:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=XtkBsCEZFJUmXzaORwxd3Muknk5RrVpgR0APvnd2NTc=; b=DSFs/n4WZFSn1e4rsGgZeCNcAx5Rk7PvJRqZDf0L4DbKO/eHsYnAVPDmpxfVRcnRIROg /rxUq5J1uNcZzOAME4SAQsm8O5URuA4zv32+TX/gMpveNCK2IQ36hHX0H2Ts5kigGWB5 kfjTTRCxq1A3CVI7dYJw2hBesJQaiTufM0Bxhq10JoljqoB4RCIcLgEQpjmIjAdDxJFL cU7psklDYWs5YYYBkjx9XNSUN/PeYjdi0fEJqNdzorkf7Umt27nsM5wfavfXEm4Df88t hr6oMZYvXypXRvDSqCMqACuYUn64X96Y/W6bAxdxwfaKbB+R4IpH2n3TnYblynf2iM5D vw== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2120.oracle.com with ESMTP id 2nxxkqfrfr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Nov 2018 03:52:36 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id wAS3qZEb009546 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Nov 2018 03:52:35 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id wAS3qZBs000579; Wed, 28 Nov 2018 03:52:35 GMT Received: from localhost.localdomain (/70.176.225.12) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 27 Nov 2018 19:52:34 -0800 From: Allison Henderson To: linux-block@vger.kernel.org, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: martin.petersen@oracle.com, shirley.ma@oracle.com, bob.liu@oracle.com, allison.henderson@oracle.com Subject: [PATCH v1 5/7] xfs: Add device retry Date: Tue, 27 Nov 2018 20:49:49 -0700 Message-Id: <1543376991-5764-6-git-send-email-allison.henderson@oracle.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543376991-5764-1-git-send-email-allison.henderson@oracle.com> References: <1543376991-5764-1-git-send-email-allison.henderson@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9090 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811280033 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Check to see if the _xfs_buf_read fails. If so loop over the available mirrors and retry the read Signed-off-by: Allison Henderson --- fs/xfs/xfs_buf.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index dd8ba59..f102d01 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "xfs_format.h" #include "xfs_log_format.h" @@ -808,6 +809,8 @@ xfs_buf_read_map( const struct xfs_buf_ops *ops) { struct xfs_buf *bp; + struct request_queue *q; + unsigned short i; flags |= XBF_READ; @@ -820,7 +823,30 @@ xfs_buf_read_map( if (!(bp->b_flags & XBF_DONE)) { XFS_STATS_INC(target->bt_mount, xb_get_read); bp->b_ops = ops; - _xfs_buf_read(bp, flags); + q = bdev_get_queue(bp->b_target->bt_bdev); + + /* + * Mirrors are indexed 1 - n, specified through the rw_hint. + * Setting the hint to 0 is unspecified and allows the block + * layer to decide. + */ + for (i = 0; i <= blk_queue_get_mirrors(q); i++) { + bp->b_error = 0; + bp->b_rw_hint = i; + _xfs_buf_read(bp, flags); + + switch (bp->b_error) { + case -EIO: + case -EFSCORRUPTED: + case -EFSBADCRC: + /* loop again */ + continue; + default: + goto retry_done; + } + + } +retry_done: return bp; } From patchwork Wed Nov 28 03:49:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 10701779 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B2AA814BD for ; Wed, 28 Nov 2018 03:52:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A39BF2CD63 for ; Wed, 28 Nov 2018 03:52:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9749A2CD49; Wed, 28 Nov 2018 03:52:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D78B2CD5F for ; Wed, 28 Nov 2018 03:52:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727466AbeK1Owp (ORCPT ); Wed, 28 Nov 2018 09:52:45 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:50990 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727351AbeK1Owo (ORCPT ); Wed, 28 Nov 2018 09:52:44 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wAS3mqb2033449; Wed, 28 Nov 2018 03:52:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=ZCXvsAPo6OYYs9OnVI2LKGBoGcqQFZjhpapjNkfKV0s=; b=ok9UvSOjuDlKRm4TVLyev5+xwxyKSoJ1u2OZlSx0ygRppRlETpCn5pOUC0U4xzCJtp1y UCMTK3NzpFTwsXxVduVTlcsjv/Y7L0tcuCGs8+JDMirtIkPwJotEkEkgoO9XCUlBbiXO YX7CwPwea/tt0SHkv1GUOtb6sIR5XgKrYYXbRyiPC4h/OcHfiAkgGf/1nnYFHxnOi3Gr UmBIJpshqGT6loQ1JHbFz9mWcgaBBEE+dNNRxrC+xf/gNxp2l9Smk/vZUb+zNVSq/2rN PG7/PkLteraLe5PT3QuawAdwlQhcYunULljeJzrJVMAAq+67wPe6ZODHxIsKV+Sp6h0G QQ== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2nxx2u7tku-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Nov 2018 03:52:36 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id wAS3qaqK009600 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Nov 2018 03:52:36 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id wAS3qa0Z028909; Wed, 28 Nov 2018 03:52:36 GMT Received: from localhost.localdomain (/70.176.225.12) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 27 Nov 2018 19:52:35 -0800 From: Allison Henderson To: linux-block@vger.kernel.org, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: martin.petersen@oracle.com, shirley.ma@oracle.com, bob.liu@oracle.com, allison.henderson@oracle.com Subject: [PATCH v1 6/7] xfs: Rewrite retried read Date: Tue, 27 Nov 2018 20:49:50 -0700 Message-Id: <1543376991-5764-7-git-send-email-allison.henderson@oracle.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543376991-5764-1-git-send-email-allison.henderson@oracle.com> References: <1543376991-5764-1-git-send-email-allison.henderson@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9090 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=880 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811280033 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If we had to try more than one mirror to get a successful read, then write that buffer back to correct the bad mirro Signed-off-by: Allison Henderson --- fs/xfs/xfs_buf.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index f102d01..81f6491 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -847,6 +847,14 @@ xfs_buf_read_map( } retry_done: + + /* + * if we had to try more than one mirror to sucessfully read + * the buffer, write the buffer back + */ + if (!bp->b_error && i > 0) + xfs_bwrite(bp); + return bp; } From patchwork Wed Nov 28 03:49:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 10701773 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5F45013AD for ; Wed, 28 Nov 2018 03:52:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 500172CC4E for ; Wed, 28 Nov 2018 03:52:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 43F102CC54; Wed, 28 Nov 2018 03:52:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C92AF2CC4E for ; Wed, 28 Nov 2018 03:52:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727507AbeK1Owr (ORCPT ); Wed, 28 Nov 2018 09:52:47 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:51018 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727303AbeK1Owq (ORCPT ); Wed, 28 Nov 2018 09:52:46 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wAS3nT5F033592; Wed, 28 Nov 2018 03:52:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=BDUE6wDq/IbemDKwp/UVciMiYE8vE607IFhP3GTLrWc=; b=NS/jKRybQ+dpqYqVhrQoFpv/cqqqSIQybQAmwhgQAkas9G1XwQ+E1jIdZGFDPo8wxC3r RBfiG1ksStLtt0d/f/g8OsGfBBkRYwpqzITuDiDKitgrZn6JMRrOwfatlCg4S+Ctrp2Q RkYsQ3jFnhui7xuGGoixTyEyBkvI2WL50iZlxAtkyhiY78dhh291icl2vmOupPvUhkSq FwBlTpj8PlaG40yfPCqKauTxnpY5c2xPpm6phtWza7V9twmEysr18u1n8zh8dgx7xGbv 2gZPzp9qBDojByYb5YrXpjzXwScCiwD/FraZoiZjTR4x5ZqHPNYptuDW1S1FRKqUdcnX 3w== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2nxx2u7tkw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Nov 2018 03:52:38 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id wAS3qbVO012583 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Nov 2018 03:52:37 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id wAS3qbr1006058; Wed, 28 Nov 2018 03:52:37 GMT Received: from localhost.localdomain (/70.176.225.12) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 27 Nov 2018 19:52:36 -0800 From: Allison Henderson To: linux-block@vger.kernel.org, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: martin.petersen@oracle.com, shirley.ma@oracle.com, bob.liu@oracle.com, allison.henderson@oracle.com Subject: [PATCH v1 7/7] xfs: Add tracepoints and logging to alternate device retry Date: Tue, 27 Nov 2018 20:49:51 -0700 Message-Id: <1543376991-5764-8-git-send-email-allison.henderson@oracle.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543376991-5764-1-git-send-email-allison.henderson@oracle.com> References: <1543376991-5764-1-git-send-email-allison.henderson@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9090 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811280033 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds new log entries and trace points to the alternate device retry error path Signed-off-by: Allison Henderson --- fs/xfs/xfs_buf.c | 14 +++++++++++++- fs/xfs/xfs_buf.h | 1 + fs/xfs/xfs_trace.h | 6 +++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 81f6491..f203ddebe 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -833,6 +833,10 @@ xfs_buf_read_map( for (i = 0; i <= blk_queue_get_mirrors(q); i++) { bp->b_error = 0; bp->b_rw_hint = i; + + if (i > 0) + xfs_alert(bp->b_target->bt_mount, + "Retrying read from disk %hu",i); _xfs_buf_read(bp, flags); switch (bp->b_error) { @@ -840,6 +844,11 @@ xfs_buf_read_map( case -EFSCORRUPTED: case -EFSBADCRC: /* loop again */ + trace_xfs_buf_ioretry(bp, _RET_IP_); + xfs_alert(bp->b_target->bt_mount, + "Read error:%d from disk number %hu", + bp->b_error, bp->b_rw_hint); + continue; default: goto retry_done; @@ -852,8 +861,11 @@ xfs_buf_read_map( * if we had to try more than one mirror to sucessfully read * the buffer, write the buffer back */ - if (!bp->b_error && i > 0) + if (!bp->b_error && i > 0) { + xfs_alert(bp->b_target->bt_mount, + "Re-writeing verified data"); xfs_bwrite(bp); + } return bp; } diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h index db138e5..23c9c3e 100644 --- a/fs/xfs/xfs_buf.h +++ b/fs/xfs/xfs_buf.h @@ -300,6 +300,7 @@ extern void __xfs_buf_ioerror(struct xfs_buf *bp, int error, xfs_failaddr_t failaddr); #define xfs_buf_ioerror(bp, err) __xfs_buf_ioerror((bp), (err), __this_address) extern void xfs_buf_ioerror_alert(struct xfs_buf *, const char *func); +extern void xfs_buf_ioretry_alert(struct xfs_buf *, const char *func); extern int __xfs_buf_submit(struct xfs_buf *bp, bool); static inline int xfs_buf_submit(struct xfs_buf *bp) diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h index 3043e5e..1d98a3e 100644 --- a/fs/xfs/xfs_trace.h +++ b/fs/xfs/xfs_trace.h @@ -276,6 +276,7 @@ DECLARE_EVENT_CLASS(xfs_buf_class, __field(int, pincount) __field(unsigned, lockval) __field(unsigned, flags) + __field(unsigned short, rw_hint) __field(unsigned long, caller_ip) ), TP_fast_assign( @@ -286,10 +287,11 @@ DECLARE_EVENT_CLASS(xfs_buf_class, __entry->pincount = atomic_read(&bp->b_pin_count); __entry->lockval = bp->b_sema.count; __entry->flags = bp->b_flags; + __entry->rw_hint = bp->b_rw_hint; __entry->caller_ip = caller_ip; ), TP_printk("dev %d:%d bno 0x%llx nblks 0x%x hold %d pincount %d " - "lock %d flags %s caller %pS", + "lock %d flags %s rw_hint %hu caller %pS", MAJOR(__entry->dev), MINOR(__entry->dev), (unsigned long long)__entry->bno, __entry->nblks, @@ -297,6 +299,7 @@ DECLARE_EVENT_CLASS(xfs_buf_class, __entry->pincount, __entry->lockval, __print_flags(__entry->flags, "|", XFS_BUF_FLAGS), + __entry->rw_hint, (void *)__entry->caller_ip) ) @@ -309,6 +312,7 @@ DEFINE_BUF_EVENT(xfs_buf_free); DEFINE_BUF_EVENT(xfs_buf_hold); DEFINE_BUF_EVENT(xfs_buf_rele); DEFINE_BUF_EVENT(xfs_buf_iodone); +DEFINE_BUF_EVENT(xfs_buf_ioretry); DEFINE_BUF_EVENT(xfs_buf_submit); DEFINE_BUF_EVENT(xfs_buf_lock); DEFINE_BUF_EVENT(xfs_buf_lock_done);