From patchwork Fri Apr 8 03:07:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuezhang.Mo@sony.com" X-Patchwork-Id: 12806006 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F51DC433F5 for ; Fri, 8 Apr 2022 03:09:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233859AbiDHDLJ (ORCPT ); Thu, 7 Apr 2022 23:11:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231199AbiDHDLG (ORCPT ); Thu, 7 Apr 2022 23:11:06 -0400 Received: from mx07-001d1705.pphosted.com (mx07-001d1705.pphosted.com [185.132.183.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2DE4106124; Thu, 7 Apr 2022 20:09:02 -0700 (PDT) Received: from pps.filterd (m0209326.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 2382kRDi008391; Fri, 8 Apr 2022 03:08:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; h=from : to : cc : subject : date : message-id : content-type : mime-version; s=S1; bh=JspmJYtyelfjVeO+f5YWb8WrG8nbY3WkFaGaB2cB3dU=; b=N8caXLslSYWZXj8VnKUTuVUG5Y3iDP4PVQKD2cqziy6/vn/4q0NWm2F0u5PvEvpSOxQs 3+tNPHZWxM/X/F73I27D48ENh7zE5X1yypYzlDYliAxF9mBUcHQcFYy9nxmJXD0n8DDd B37qwCP7t4EViyennJKPCY/iQsFQnsBXmydfrEumptVw3Evw3b45E7onVNaN5A3qKLSw WEg9gS6xy4h6A2huwVkPH7lC2vJZT8mHqXsiGPcfZ7AxTFDxo8zILaPFFwuVhXBEOiSk 61+Ac8x73TWMkGd1pIrPDahsHou9u7bOwnRkC7rt8k2uwAqcYm69NBYopjEXi1k6/FX1 yA== Received: from apc01-tyz-obe.outbound.protection.outlook.com (mail-tyzapc01lp2046.outbound.protection.outlook.com [104.47.110.46]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 3f8yhgjfuf-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 08 Apr 2022 03:08:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a6Ba0FH2Drse94ZLm+XUyaG5HTqJKkZghNhdoLKzGbJk5/AJnHzcFzZmX6nbOvfaC/zUA+yPkbaPzGSrfy3jJg5wJeica0VqhbfdqZZbLGiliq+Z5I/1W7t/ODSMKhryzxfxJARkUWMSFG5KX9gwH/S4gR2qbmXrtznRIC71ETH8Pv2MWe/6zhKFhueex9su9sHydfT1Z5tCTO9glIZ9joqqumTr7zSbIBaGUttuUpCWqcRUAoecYh8e8VCwugHrJFt/6+Py0J0EmW3ddIgxV51KlwRH9LempU1PVUNoiy/cm0cu4kDZ+ycM8MxLZ2qGpglQJyZPmyllrYExQJFysA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JspmJYtyelfjVeO+f5YWb8WrG8nbY3WkFaGaB2cB3dU=; b=imuZIO1l1rApmhV08jTt0gnR/aDCDEh9avKh8mU+8JeIUqCwavbyrn/AKbWRbowG4fblYDIIQW2CItDh4yMXNbEhomarUsjqU0QfrF5KsF3D6dl5Hy/+fa7+BlRuVPa9hHAaAFEzgHNyNYCz3hmsNQ50bIMmt5jxnKEbR/9/etDoHaiLUK/r4e2d376ypUMVNmr9DFhIKxqwIO3gKS1Pg12dbcb9EsPcRHLV1RqPKatXGEVQvH79Y/hkmOvyV8UbpI6icOtmTAS7PiofZSkqEdqpPItdUlcnCiStZvDR5ZdTY3Bgp/oFkyCigKYXCLnyCiAwnWIhXt/CXUHwfw/1BQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=sony.com; dmarc=pass action=none header.from=sony.com; dkim=pass header.d=sony.com; arc=none Received: from HK2PR04MB3891.apcprd04.prod.outlook.com (2603:1096:202:35::13) by SG2PR04MB3866.apcprd04.prod.outlook.com (2603:1096:4:a3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.22; Fri, 8 Apr 2022 03:07:44 +0000 Received: from HK2PR04MB3891.apcprd04.prod.outlook.com ([fe80::7440:bc88:211:6094]) by HK2PR04MB3891.apcprd04.prod.outlook.com ([fe80::7440:bc88:211:6094%4]) with mapi id 15.20.5144.022; Fri, 8 Apr 2022 03:07:44 +0000 From: "Yuezhang.Mo@sony.com" To: Namjae Jeon , "sj1557.seo@samsung.com" CC: "linux-kernel@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "Andy.Wu@sony.com" , "Wataru.Aoyama@sony.com" , Christoph Hellwig , "axboe@kernel.dk" Subject: [PATCH v3 1/2] block: add sync_blockdev_range() Thread-Topic: [PATCH v3 1/2] block: add sync_blockdev_range() Thread-Index: AdhK9MP60JwULp2VR8uDBNc4RhsS9w== Date: Fri, 8 Apr 2022 03:07:43 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 9f7d933d-0756-44a7-d52f-08da190cf363 x-ms-traffictypediagnostic: SG2PR04MB3866:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: pbHZ9mgY5JLQb6d0TyFJPfTT8JAuQ3w3mBUtN4HJC/A3IdL1hoAd8LXA1Z+0mWLVSlLwMCjiC0oy5OCG3JmY27hiAh3pEqKPde7b/9ikIXXKhi/9O9IqnIqwPK0XkFdO+ljYMQacz6t/4UzxFzNPrcMedRZ09yMrw6WCQW3fM8R9aMvmdtf1490l9TqK7S8hPespWzrib7dZq/iL6ZMqHQMsCU150H8+qOAPchOfKiZi0JDugNm/ZJfGMB1vOrfNMJE7hSz1IHR98G4N7aOlxjp91VFq6zBNUz6sNCjOJGyspkeaj6TiSB3EaVCbA1Ezaf6RY3HxlCxfUQPJjwFEn1IQ8GaAI5SOncreVtTOH3RiBS4XInwlsIiVj134VSN/mjszSZdwZud26t4J6zoDcXmH1h3Da+C4Gt98sW8/3tqCTXa+FEEVbbmAQ6UG1Vm9vn1xS6xPllwhFVIehZfiVviUUWB522AgqwtFElV8dhDPoxATfBPnAE5AfUGZCbWkNbTLL97HxVwmQEZj/Wa/xly1KDhsyQizfv7hRBoTRzNf/JTO2xLdTeodfpAvvJljAqcPfgyauUZG3yzMf66g0SUJakW/Ug/nzX+ynOXg2mBFH+DO0flXkZXsjfBe3WWQCy2Y3+ZAIe14AdqAp576+QABjlsOJPSyJaHTPKsSRSfdbF2djNIsLJ4hlWXMRiWjjS7D/nUWdVR+/OBreIjhjA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HK2PR04MB3891.apcprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(83380400001)(7696005)(6506007)(52536014)(71200400001)(82960400001)(5660300002)(33656002)(8936002)(38070700005)(2906002)(508600001)(86362001)(99936003)(55016003)(9686003)(54906003)(186003)(26005)(122000001)(38100700002)(110136005)(316002)(76116006)(4326008)(66556008)(66476007)(66446008)(64756008)(66946007)(8676002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?P+deAR1A+SLr0C4RAyaOv5dVM/vl?= =?utf-8?q?O44M8x1C5NiGNEoECZGnYvNVIhXMxBXizhWcL3+5fLtN4yDWgIFB/om46gX7djDaa?= =?utf-8?q?6eiS/jZmIonGUM6Uhru+lZBmm+vlgrR4XHfDxbtnyxT4YibqYb0jcIShXY27OMyDz?= =?utf-8?q?wrn+OvUoldgZ4Ala6df7E+hKww9cCLVvLuSZeVXh7NB9KnM8mZIrOym3ZdfXt/zyI?= =?utf-8?q?bMskTz2B3kxRhEwaC2/8Mvmy4xqWzrBeYE/08LYRoJxv42MLCYVYVYQlvPYMVNoqE?= =?utf-8?q?JrffqJID6Ods4vLtZoww+UHruOKKGFhGGAuQ6Zwx66jE+xVisFhAxO5bojRDoGTnG?= =?utf-8?q?HSViP3x31VSSCVi0lmduL0IKOsTQoMpwMiSqx/yvHnXDyrF+169PTYWm4Mc6K1ahe?= =?utf-8?q?AoaV0Ioa9LOpYQF/KVrIW04lQoHMIY0WzEHTvuu8jRlmIJ0HMZ9S/FcErskYJnn/J?= =?utf-8?q?U04tgl+aHL/Hm4uR2PfjvRliHAHCnLNHUsWVCAxlzd2DNTVHI8yw8Rqfjl2YZVHZ0?= =?utf-8?q?baW9YFivPC8PzKOEyl2vTK9GsQjPakIEwBNdffItp1CcE5TlGB/0GgDHtM8vFOzmM?= =?utf-8?q?rO6nnbeIPAW9aai3akyy8ut+N4HhYfIGyJl+pxbU52W8oZXuMQ0NlEYSfTXMa/mTN?= =?utf-8?q?76xjvULyTckh+b0ifBxOzKlr3DotKPY+YHFPiymLeAbUay97qpbn2HUCfmxheWNyG?= =?utf-8?q?X6KmqdsvodZzW3goFKU2aXrvxCsLZpK1gJioUW1nnu/2Q3LR797G0p/n3iQgbLnUU?= =?utf-8?q?DsK3ko4vHg3QcgHMK7X1n7XjHf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RTE4zGL0yX4Djz6w=3D=3D?= MIME-Version: 1.0 X-OriginatorOrg: sony.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: HK2PR04MB3891.apcprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9f7d933d-0756-44a7-d52f-08da190cf363 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Apr 2022 03:07:43.9429 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 66c65d8a-9158-4521-a2d8-664963db48e4 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: W4+ceSZXVfCysEoCkDisFfzxOABTRQRSvSJyDwalSG7oy/zQkAhjlz3idJW7M/m6K4pO/MsqutPXFBgOx9vR7w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2PR04MB3866 X-Proofpoint-GUID: y0no5m2ISEEEJiwXFFTQT2d89UdtKtCz X-Proofpoint-ORIG-GUID: y0no5m2ISEEEJiwXFFTQT2d89UdtKtCz X-Sony-Outbound-GUID: y0no5m2ISEEEJiwXFFTQT2d89UdtKtCz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-04-08_01,2022-04-07_01,2022-02-23_01 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org sync_blockdev_range() is to support syncing multiple sectors with as few block device requests as possible, it is helpful to make the block device to give full play to its performance. Signed-off-by: Yuezhang Mo Suggested-by: Christoph Hellwig Reviewed-by: Andy Wu Reviewed-by: Aoyama Wataru cc: Jens Axboe Reviewed-by: Christoph Hellwig Reviewed-by: Jens Axboe --- block/bdev.c | 7 +++++++ include/linux/blkdev.h | 1 + 2 files changed, 8 insertions(+) diff --git a/block/bdev.c b/block/bdev.c index 13de871fa816..8b549b071bd6 100644 --- a/block/bdev.c +++ b/block/bdev.c @@ -200,6 +200,13 @@ int sync_blockdev(struct block_device *bdev) } EXPORT_SYMBOL(sync_blockdev); +int sync_blockdev_range(struct block_device *bdev, loff_t lstart, loff_t lend) +{ + return filemap_write_and_wait_range(bdev->bd_inode->i_mapping, + lstart, lend); +} +EXPORT_SYMBOL(sync_blockdev_range); + /* * Write out and wait upon all dirty data associated with this * device. Filesystem data as well as the underlying block diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 60d016138997..331cc6918ee9 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1547,6 +1547,7 @@ int truncate_bdev_range(struct block_device *bdev, fmode_t mode, loff_t lstart, #ifdef CONFIG_BLOCK void invalidate_bdev(struct block_device *bdev); int sync_blockdev(struct block_device *bdev); +int sync_blockdev_range(struct block_device *bdev, loff_t lstart, loff_t lend); int sync_blockdev_nowait(struct block_device *bdev); void sync_bdevs(bool wait); void printk_all_partitions(void);