From patchwork Mon Mar 27 09:53:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13188981 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 78FE4C7619A for ; Mon, 27 Mar 2023 09:54:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230017AbjC0JyS (ORCPT ); Mon, 27 Mar 2023 05:54:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232984AbjC0JyQ (ORCPT ); Mon, 27 Mar 2023 05:54:16 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E15E524E for ; Mon, 27 Mar 2023 02:54:12 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32R9K4oi025981 for ; Mon, 27 Mar 2023 09:54:12 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 : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=6yCfIyNz9wDDsLyeinKiFhy9/RYYaBLQP+ji3WXF7as=; b=Sk0K2myck+sGmy+8GidPfB0qatnPCiwvqISskZyPTuMzh7IqEobt4XuPhaTbsAaEhATX EuJIQpjSQ/C2WklpHkMwon7VrsuH9oBC5zmo6CUVEIyfWfFqZD67XTht4agPcD5WRF5C TzFJh8KyyHehZHzxa5E9U5r2WHHyJ7qxR5C9YeGq1s2wzWyVGc2gRfJS+J3eFuyfQMAY phCW2ZpSvHnT/JgFfFJYyjzBKvF3Q0qVvw+lditHShHiMR/+OsI5ebA+PS8jBaPfJBeg ofbjiRICeT/6JEwnzY+BFQ+0NTf/NDej9s7WFRgvIFRMqKmzhckN4p2ty70s0eT6Q6kR Sg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3pk8dsg30b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 27 Mar 2023 09:54:12 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 32R9Wkb3005428 for ; Mon, 27 Mar 2023 09:54:11 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3phqd4h3gt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 27 Mar 2023 09:54:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fjEzP/2QY06kWxSQjUGPajdD2b6v+FSdmpqA7Z+cytEeJXvFjsoRCqipVB3s2Oo69gGovX1CdgUDwl1b1oF3LWKn6ndb5pD2qxI9WN2dNZzb4i6PjQFwOX97XkiUUkR3tvP5xdQxeW92g6FB14sq/QKePT+1vCPs4EHQ4M1RQC6dRPSV1HgK4MgzMGvjtEDgs7u8z0rBOEDlZN8aKjXxl3ttXOux3tJnyD7vplJ5Za48WXVqpH/53Qtlzg4aiNzMqjK9Eis48VHvktlJYU81NYhrW7U3/Lhz9cipJnnL27jA52Yb9kuLhHi5y017lPDKN4fHEPcDMC3aZ6DPEQBYww== 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=6yCfIyNz9wDDsLyeinKiFhy9/RYYaBLQP+ji3WXF7as=; b=JfB7xxoFwucmP52bhwbJQat478x+5VFGz1AW7WbJQzKkFXAXpl4DFlcDS1qtI8OQN0dAAV/Uj8svkIwM4Km5Zn7tnoTITROP7mSc+sUGyE5P6swY7NgO2jvJ0suuPCARD7THJWTTVtbEewxJcWJnepzse/weUIWbtaG58XVb8ilY7u61wdGuPaUrRbuFzEQpDHEhR/yEGiWUZXoqjl4VE5UREmV96Osa0wD9t0qGlOQuV8LFmUAmXD9EqhoqPqj0Ij0vWyGhPQXAFOhLZ4kQGyI0cGM1qRv7dFDG7D6QgxT/dPCVTTwSm135HWXQGOPZIv2PPV2kO7fwyL4+SM+NMQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6yCfIyNz9wDDsLyeinKiFhy9/RYYaBLQP+ji3WXF7as=; b=xn1dw65p9HjTOktS2T1RjMTUgR4Hzi5HtzXqZwOq4r39n/l2f3ZmIfF3rPatml0ElwNT8/ldrD1mLcn+sdKDcSRsGj0dcr0JUpf/uaZKAFX+IEL2uyHjJyq/mH0DoEHbPoGjmUxVZEfzfglgfFtpkdUrn0ytHMiqWlHCml5sMro= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by SJ2PR10MB7597.namprd10.prod.outlook.com (2603:10b6:a03:53d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.41; Mon, 27 Mar 2023 09:54:09 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::3eb1:c999:6a64:205c]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::3eb1:c999:6a64:205c%6]) with mapi id 15.20.6178.041; Mon, 27 Mar 2023 09:54:09 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH 1/4] btrfs: move last_flush_error to write_dev_flush and wait_dev_flush Date: Mon, 27 Mar 2023 17:53:07 +0800 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: X-ClientProxiedBy: TYCP286CA0066.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:31a::10) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|SJ2PR10MB7597:EE_ X-MS-Office365-Filtering-Correlation-Id: 2096b1b9-2449-44d1-2b0e-08db2ea935ac X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Zk/2ln15Kuh0BPxmEKyjD+eg0JTqUE01sZLKT7donWeonVLHaApdicA06VQlutQ1ZFK8LZra4GFA+kqtoD62FafGdBrt9i7th1T8lz8ZnFkAukrYzpLcU78Y1kg9I+BjF9rGFL27nK2EpzKD1lIvZBDRwdlK5PEcsZqSQW9WvYD901DnS0hm9SbPtH9s5gMCjSjrbJI/e93RzuiIoRlpphXrcHf3CwFjYz3BFiAdOGdPSWGL3QR6AmPVJ/Etv3ROY/7d7D8vIzPGk8Tqk2KCRj/V4rEDXjYBv6yctWFB1Ywt9Qgf5CqzMRilGgZJiTbSNmvo93uLd5XGZUqkVqPOI8vdm9kZr0jej+t2+IqTw13y6OqDIk/dRwbfcctz3jmUJMlMmDzgZNWsMatPWhgHSQIvPrD0VTwVr89DR+C+KZ0iW1OZZenNTTusbV8sOzap4kXQmTU+pgwcKbJK47n8tZIp2JY5rkrn4N/xlsKp1PjAr7Lqvrvl+ppCKDZS56vYqqxqOoKcgWLj4mhUoh7KVuffy3+lS52b3pg6dwDUcwB1SxwPxwhpnQrL/rylW/rm X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB5706.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(376002)(136003)(396003)(39860400002)(366004)(451199021)(86362001)(44832011)(36756003)(2906002)(6486002)(107886003)(83380400001)(2616005)(478600001)(4326008)(316002)(6916009)(66556008)(66476007)(8676002)(66946007)(6512007)(186003)(6506007)(8936002)(5660300002)(41300700001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BlloxBTgZkUiEGwtTmEYduybGeAb4yYVRtulqhaqRJ1yNyCMEWic0e+mz5l9JJEZQhoPUaEZMgrxcc8R9UTlMr/sGEhT1Gj+Bw5TEwx31UbsZRtNkxp3fdXAftQXab3RhVsYVgwj9zCucZhD2QyqZJC4HSOpuLJCe5tUKXpRsmChhRWGhA3LwrsrihpyNe8fNHrKzqZ3PDfX6GKZoyOjENwpbMteePRLtjIfIaEa3haYyppLU0N0Z1t4Wt4hSfj2+lWLKlOSG6j7N2/idafNqcJHjmWfd0NgMq01IrbBxUe45+NRDTCwA2CMTvbS8HvH5TimzRrMkKIfMT7mR8jFOnwW2wEyiKiYw63rEw172GtgI/kcfWSJXKL2GEQAu3BhzG18Dp+CCReA4TLtgNkHyuONToA/IUPxZWiDiTCKspna4ccq9F3B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UoB79W3OQ8n5p9PHOIpRTXgdAM7Fi2Gu3+SEFmtgWHzR7/Yk06D+YWLO6w7i5xnG23I8IccRvKFiUi6P1PETq/L3RnJb4cwDo9RCG2088iQAstyt+3cHsxnGZGyw= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 2qhm7ejhuT9cEKcNVJDqHo9agjy4bOXGN+i0EYDd4MnwYpyQ1JEyyUz61e80AfowTE1n0DByNGfMOqhDtdDozireqPmcTKWEFc0mlarZgE4r9rFWe64XJZLghNGK6//XzsCly4l/v0Ss9muMTaol1m/eZzy2moEuFjcWwR5vs7C+HQG4ow+4qYFaZgeBrGOvLd/FK09jFLVBFX35852DpMKrjUvNb6I07SGxw2O88VAw4ipaJnWnhXH+Y+1oJyUkqQt05HHc8LCRpCEBsv+lHsUpVGl3IvovtstoebkPzWAk+KJJ8Fyfw7pbXqbGTm33YH5wXHUgYSjX+Y8RIjCRMtfENs1+UPqLlL/Tgzx02XFtv3+FzDws6b7+pkAsEanzvYklUgpil/dfXk7ZMCHL+wE5H9ikbSnO8v0RR5OOe75lqOUWx21N5SrVh5MFhh6TSHc/Pis/9SzEFIPPcwqnCtEhtl4MLqaoIJjxFouZZlnuk56A+rDuAlgloECqGWKyfEm4sFK/sOeEmlJoI0xj/scWl86hIjhuYfGKyKQGS29XP/lIItI7eic/j1siNAbYcFRz6cAOYf71Y3Yw9yPoaKrQw9jCn3wwfXW3Ky3VPI8x/FU1B1vFeF6DpuvP0pMAzJabvGi8xPQQQIGxL3u6SWCXnAG0iFtFe6XHBqtKxi5F7xh4RRxjKbi/XNHMaQlAyic/kRqskkTyvgiamxkSGh865h1KAYnsArF0E3YRzfawz9lvNGtqnS+EUH9Femgk0chj8JhmA//n5HDXqv7iUw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2096b1b9-2449-44d1-2b0e-08db2ea935ac X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2023 09:54:08.9146 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Emp0IqVskqk/EFnwx1n/sv/d3DrYo8YhQDQieZCE8VEsph9KCa7Uphvzn/FKffYoqcpjdrfv/htp48Rq2TFX3Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR10MB7597 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-24_11,2023-03-24_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 phishscore=0 suspectscore=0 malwarescore=0 spamscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2303270080 X-Proofpoint-GUID: qHKgfnMYT0DQebCVcXwyXRpE9SDM5hOj X-Proofpoint-ORIG-GUID: qHKgfnMYT0DQebCVcXwyXRpE9SDM5hOj Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org We parallelize the flush command across devices using our own code, write_dev_flush() sends the flush command to each device and wait_dev_flush() waits for the flush to complete on all devices. Errors from each device are recorded at device->last_flush_error and reset to BLK_STS_OK in write_dev_flush() and to the error, if any, in wait_dev_flush(). These functions are called from barrier_all_devices(). This patch consolidates the use of device->last_flush_error in write_dev_flush() and wait_dev_flush() to remove it from barrier_all_devices(). Signed-off-by: Anand Jain --- fs/btrfs/disk-io.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index b638e27468a7..7f3fa5e2253d 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -4072,6 +4072,8 @@ static void write_dev_flush(struct btrfs_device *device) { struct bio *bio = &device->flush_bio; + device->last_flush_error = BLK_STS_OK; + #ifndef CONFIG_BTRFS_FS_CHECK_INTEGRITY /* * When a disk has write caching disabled, we skip submission of a bio @@ -4111,6 +4113,11 @@ static blk_status_t wait_dev_flush(struct btrfs_device *device) clear_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state); wait_for_completion_io(&device->flush_wait); + if (bio->bi_status) { + device->last_flush_error = bio->bi_status; + btrfs_dev_stat_inc_and_print(device, BTRFS_DEV_STAT_FLUSH_ERRS); + } + return bio->bi_status; } @@ -4145,7 +4152,6 @@ static int barrier_all_devices(struct btrfs_fs_info *info) continue; write_dev_flush(dev); - dev->last_flush_error = BLK_STS_OK; } /* wait for all the barriers */ @@ -4161,12 +4167,8 @@ static int barrier_all_devices(struct btrfs_fs_info *info) continue; ret = wait_dev_flush(dev); - if (ret) { - dev->last_flush_error = ret; - btrfs_dev_stat_inc_and_print(dev, - BTRFS_DEV_STAT_FLUSH_ERRS); + if (ret) errors_wait++; - } } if (errors_wait) { From patchwork Mon Mar 27 09:53:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13188982 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 0DCFAC7619A for ; Mon, 27 Mar 2023 09:54:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232954AbjC0JyY (ORCPT ); Mon, 27 Mar 2023 05:54:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232888AbjC0JyX (ORCPT ); Mon, 27 Mar 2023 05:54:23 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EACE49EB for ; Mon, 27 Mar 2023 02:54:22 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32R9nHNR011293 for ; Mon, 27 Mar 2023 09:54:21 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 : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=i7lzdOonSAUyD/S7YYprK0+BQpU5HdG3cUac+F88ClQ=; b=bnjVMhGOsdN25G/27fbstO+tgiXVOMaF4hgDg3V0lrv4z487u8htnFy9gZ9niFR4HjAl d2U9/lswo/iCSS12eswuxY6k82dY1393PdgIZvIQv/GTXcoVMZATMU+vz28EkVym4sPd aah9pngDIM7IRZh4DC0dS3QtFnqKVoADGH+0+7Rgn/E/ldF47YreYRl3oEUvH2foqbI3 X/wzomWnZShe/72cRP266V0lGkNLkDck0zIQ5nsXtTCg6y3yHwv/r+1lpi4ULX1SJLWC 05oWGUqutnTR4hb/cE0HRqQbrjbQai7XwIcpfGMvfl7raNL61Z/sgTOMIK3ckhtPhgLw gg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3pk8ug00gs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 27 Mar 2023 09:54:21 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 32R9gqeY020313 for ; Mon, 27 Mar 2023 09:54:20 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2175.outbound.protection.outlook.com [104.47.56.175]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3phqd4rtas-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 27 Mar 2023 09:54:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hQAjKd5uQxTN/OX3xP9hFAxICTHkZ8lD+0PQHyL3qI4dmGIQiR2hDSHcDpZCRgUAF3PBNU4na+GGbpcwcqZxRQQilg2RacdvXpjGyshMpCK4pk/LOf0FYfCrKhI+Vb9MZtOQcI6brsYFEKN+pWaaR1MCaQKJqy+vi3fWPHFK6vxxAd7LM+sEjhZcIHS+aAHJwLEuXM0JUhpZP9o+4c+ZiPNTkFbnwm7BEyA0meWvvlvEW8tdboaffGQG+MobDiX/sGTxZBk453oCniNBzPVjuNK2DvFZpa9D7l2g7mLzr4AMoxxhSkKckk15gWH8mENqfXMEWpMtOsPDo+3BXHhtRg== 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=i7lzdOonSAUyD/S7YYprK0+BQpU5HdG3cUac+F88ClQ=; b=lQ3caTZiLDBFEY7AS6YiMMC/SRLLz9IR/kBxunPWv006u6xmNu/yhVjHPpeVDzwrQAbB5tx/6BSwrO4UuMjCeFPwwAMsR+p+bxYHzg+Pn/HO2Jy/EQkAAMg/VCZzZXwaxVrOS6R82zPHxHHVP1294PWeHGus2Dmjq+J6T/PoWFSK3T2pvh63v5xjz7/Lm5Zu+9qIgFsKYsv15J08l9v/IzVAfIAbbBw1HqpYt9ttvVCvuMJ9+MCcugNMkr94ZKr8DuqIjxFBSnXXSi4KHMkwwpIZeuBogPCu0tAoe4nKigIWy7ed4GZkLPKKzX3lAiiXdgeV8UsFtmNBQk1F14fpBg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i7lzdOonSAUyD/S7YYprK0+BQpU5HdG3cUac+F88ClQ=; b=mZ9uzQ+BZ6DsUI2s06Pe+woQv2PlsHEkkuHQdg3Okuo5ZOCx4dxbyXpgn8v+pguc/8jb+0I15+lnU6ov2aV3z6a44Qr0usS3j4Md80wGSfDlDJYzE0e9M0B2WtID+UyMHJ9640za20g2RGiPKGacK/bPxuziqk/zcB3y9Bv3Tkw= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by SJ2PR10MB7597.namprd10.prod.outlook.com (2603:10b6:a03:53d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.41; Mon, 27 Mar 2023 09:54:18 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::3eb1:c999:6a64:205c]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::3eb1:c999:6a64:205c%6]) with mapi id 15.20.6178.041; Mon, 27 Mar 2023 09:54:18 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH 2/4] btrfs: opencode check_barrier_error() Date: Mon, 27 Mar 2023 17:53:08 +0800 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: X-ClientProxiedBy: TYCP286CA0244.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:456::19) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|SJ2PR10MB7597:EE_ X-MS-Office365-Filtering-Correlation-Id: 7c63a4b8-46f0-4d17-fece-08db2ea93b74 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hFoGb9hqhwqdzrnsXJbKotxD5ZIeaTSZw2vDlImrw1gUVYNdYRnlFFYjw+QNy7SOgQYqy9cbCiJ/BG0jYJnpiV3hrl6T+REVXVdBbqNntIN0D02w2nsbLlvBbqEgyZCkEYpCpzSeFaKm0TvKMXsjLaLTx21f+kHbY3EnjQUMsVskXNxuLJzA06RCu2fDzlNpkc3LbCxT1QXkCK/n2R9xRFW2o/z12p8TFzVA8cXbtZLRhfCW6FVI6PHXf1zpyGG3zdIJMbpJsEvuqJEE24568DhskkrbJSmcp/GI8jRcWtzlo3JCs+r7V1+6DtZwSA/gR2XNnvXdsx4m0OHx2KDaCk8IrnFvKgaGdJO93TQ737EnsBKVfrDd+x5nBLGpMSIsOSZkxcOtDLK7I1VgD2UB1QQkg3FrthxfB4lefjoXQ2/Xys+FxnXlX5lF8plkjdg4gnoaW8SLwTTLJltWsRWXDd9w/3EvYwV6vD60OVFt/HkEAQOD6IqB76YfEkkmXFdmhNBLvUzHtf5WaGQfRZ4qZ61pEyWDYD+S1cWzTLncBIJ136TsnLcP1X5eWTpEAf/A X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB5706.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(376002)(136003)(396003)(39860400002)(366004)(451199021)(86362001)(44832011)(36756003)(2906002)(6486002)(6666004)(107886003)(83380400001)(2616005)(478600001)(4326008)(316002)(6916009)(66556008)(66476007)(8676002)(66946007)(6512007)(186003)(6506007)(8936002)(5660300002)(41300700001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rzcjT/51NZ5HrLQj7NmczC87m02CpfbInaRJFsL4R3IBxSRCjtaDLAjMNK6zRvIRyag0uHnYG4yqwdvbHQadMhwtKnvxUoh9xTIWhPMZ23CVEQeexNb/o/2UUeoQuGbbdqJVy60NBDSl/U7FrOmKejCnpihouCu8m7qxz0qi1p1RoykGsvM5Icm16kmqR1PAJw/+IB0z8b7Qn4kg6XKuAhB5B/hUI4p/vfPLotFm04tUbMPR5qJz+zB/3S1NSTNifoMwARcU8ePqu+GD1bmID72eWcXaiGse6ZUnOe7EeVJMkQEgvq7zrQ9tTTrAl0Gsbu/2nFBBMyaNeVpNLy+rg19b+R04gpLN8LYArCiuR1wGUAiQ3/uv+9ttIyGbVv6OFVINtv/CtYRjd/sFRyNl+6EFaA+2oUtg4vZwmN/1NactgY+zVjiUS31phWp6dLVtazhO97p2TOuiDhpSq0SfqhT5tMVlqXnWletc3bkf9tLEe5Ljj7oRWazPZ0LQHQRvhsAqwUS0oFoc1DKoXtpJjxiP+2xcEPOpN+rbDz4zdDQgf02aC9ONCvlCj0/NIglA2UlFuBBiPDRu79c4iD+ridrwVMkXLHlJxVO64Ivs93iOl865Pds3IfDfTx/daPCj8WZXwqQfhYb98M0HPUilZN/eQ/dt5BJ7KDmnymUHE6TTCSIbO/wQo//WQ0Sz4capk17ESdkItHWcOR2KkmSaIPeH2zAiCiNVJmU3xUrXYzTkUcHIHMcR+605XR79y9cyTkNV0GCAorI8lnNlFgJtXseHIEbAwsA/oqCO2bvLS8hMmE0RmlbmjyRxvk7s5F17RROyAUWWG4Fyc+NE3nhaF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K/bBpQpMTXMSjTFzeAhTfrO4PpD6GfLwPBiBIgkW1c5Buvb96dQB9+Mhmnil8IztnCVXhLTZR7tDH+tdpRWnfbTcswpYNnt/XxCzMkx5R6HeSLFDvp1YPmykMIUs5UFQWDXhPXlL15cpalvSMG+ZO8me4ZK/1aO+oQ2GUgTpUu49ONounuDpuz+yUr3fIgYiGE/fffzdyXhnRaOOktdCl+K9t+v+r3IoqbJe3pQA94S3Or3oDoXCD20DJ5Y8CBj/tND196S7WhjJcccmvc7Qx+eFACOHe8vjx9+ul+srP37af8rBHUK9VH4WCvQSyh6XqrUnwUugGTiO5jX6mhYIoWYzeZ92vvzbQG/slnsQLv4TUw36ihB+UfkzVYh0N00NyqmW3E/QJtEpDLhctKre1xjXOBhrtdgOqDxr7RP3I+nSzn1TdBrg5ViejkHbHuUd1sl3FXdu4HQZHFClUaR74SRsdEWPbLzt9bIqGN02ssiGb+2D7v+Wat8S6+DHuLQ7DvIkGhrKrgTmSZWu9w18SOvPH04njXwq4/ffmC03RopZoeFrKb+GCUPm+Op9EDBoQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7c63a4b8-46f0-4d17-fece-08db2ea93b74 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2023 09:54:18.5868 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 4hxXhF7A318aJvO8pNUNZzdPwTfr+cJ76kqrFYbu8LnE6HEPQoZVSv2fyr3TNo20DgCsFaB1c1wCy4papbMw/Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR10MB7597 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-24_11,2023-03-24_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 phishscore=0 malwarescore=0 adultscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2303270080 X-Proofpoint-ORIG-GUID: Wfd2P7eKSNKUgNnI-2Zvvj06-KwEEoTK X-Proofpoint-GUID: Wfd2P7eKSNKUgNnI-2Zvvj06-KwEEoTK Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org check_barrier_error() is almost a single line function, and just calls btrfs_check_rw_degradable(). Instead, opencode it. Signed-off-by: Anand Jain --- fs/btrfs/disk-io.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 7f3fa5e2253d..745be1f4ab6d 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -4121,13 +4121,6 @@ static blk_status_t wait_dev_flush(struct btrfs_device *device) return bio->bi_status; } -static int check_barrier_error(struct btrfs_fs_info *fs_info) -{ - if (!btrfs_check_rw_degradable(fs_info, NULL)) - return -EIO; - return 0; -} - /* * send an empty flush down to each device in parallel, * then wait for them @@ -4171,14 +4164,13 @@ static int barrier_all_devices(struct btrfs_fs_info *info) errors_wait++; } - if (errors_wait) { - /* - * At some point we need the status of all disks - * to arrive at the volume status. So error checking - * is being pushed to a separate loop. - */ - return check_barrier_error(info); - } + /* + * Checks last_flush_error of disks in order to determine the + * volume state. + */ + if (errors_wait && !btrfs_check_rw_degradable(info, NULL)) + return -EIO; + return 0; } From patchwork Mon Mar 27 09:53:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13188990 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 96989C76195 for ; Mon, 27 Mar 2023 09:59:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233249AbjC0J7d (ORCPT ); Mon, 27 Mar 2023 05:59:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233105AbjC0J7c (ORCPT ); Mon, 27 Mar 2023 05:59:32 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 728E019AC for ; Mon, 27 Mar 2023 02:59:31 -0700 (PDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32R9jujw006954 for ; Mon, 27 Mar 2023 09:59: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 : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=8b+nUYo+zEQHSknTlK6dEZh9eHnLAbQ+tSgBnqZAMvw=; b=Wd64zwill2RaXVVvemReUDzhHFsz0xlVxISnvJOdiMY2r0dia0exSlsARFr8ITSme4Zx uj2DOnoH/l78A4r+RYmoRJ3urDLEFzoEkhqRY7QY8MjTv3P/Zm64BWxHlrrrXMPhl9wy wFulSWaLPwvaFAo5ZuK1EQGLK+r+huBU7RLtZHeP8xkQvwxGsMWkrk6X/RzZf238e8n2 HzDPj3aGmf3PF845ioe9cisq4UdnLOkzTvHtbznkFrOotnZNdYTcPBqXbLCpvIVvbQeq 4gEIbKaRn6rB+oKrMlY/FBh03srVfiBz3sL3+qJMf2FpKbxvuyi8zhez9zIwi4RDH2ap CA== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3pk8snr11g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 27 Mar 2023 09:59:31 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 32R9HpSK027435 for ; Mon, 27 Mar 2023 09:54:30 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2040.outbound.protection.outlook.com [104.47.73.40]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3phqd4gu3r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 27 Mar 2023 09:54:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D3TE/L14MY+epTtbFxi6/a52hduUqVjIvcEHrcnW2J9f/sNprDpl2NSIeGojCOByZCw0zoAj+BqJcaz2Kd3f680Em65dWxaanGOK2BL4IjCmAqKNvC8UkwvjrASudlvwVqMdX5EFInBneMspizerz2xbyNmts4MU3dSCGMz3Lyehne5gIIRgceTyg+E+2wOEP6rnQ0LVZYWzDg5zr1ZKZ/pkB5hotbRKa++IDlqtTUOPVGcWvtH/62S7fzBols/61qWHU3UrSqYA+ZMvQg1zmmOocSD0SOKQadATbJhp5amGAVy/4+btaXPBMqgutJAhHCNMaDRLdjfeTSfxdQNHcQ== 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=8b+nUYo+zEQHSknTlK6dEZh9eHnLAbQ+tSgBnqZAMvw=; b=doCDGdsyZ4GnwT84venIhy0TK83cS1XWdZ5gbsmiiyFzkOWhA9NV0vDIUA8mm1pi50a19+h1FthKqJkCCzRPr6zGkOdZrF7g0PPWOyKqTsLqZxXiuhVVYPNRgXsJ7rNRVVkDRhTeDesz/ghFpkH4w4RMRavogO29E/6JtRRGXBMXB6D+BgakTbXa/ELLv9j3ldG83UrpRxW3UZTCx9pELNHOM7zFruMcDPNbgnILh/knMjG9DOd0k/f6AVNBZDzO4b3LEObg9KyvXp6y0ICu6hywG6faZrwgJlwSIF1seAWtgLHPKk/Z8FU/0P5hNlDdZ1WHDf/qKFz0MGEy6bfUHw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8b+nUYo+zEQHSknTlK6dEZh9eHnLAbQ+tSgBnqZAMvw=; b=QL+r1yjYc9BM600h+Sz7HKSL7sfvISkft8EyYCMfAIDJINGloeIJzAklymTkjN0Qzdh7WsxQLpySrMsqprbVpaZ3MBSn/eepLmXnkjtvONzQ/zxE3zoV8fwwAJJX3/rM77NwssT4HNLAan5kJHKRIRLDOsafkvhDj9Vg5sQAgCc= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by MN0PR10MB5981.namprd10.prod.outlook.com (2603:10b6:208:3cb::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.41; Mon, 27 Mar 2023 09:54:28 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::3eb1:c999:6a64:205c]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::3eb1:c999:6a64:205c%6]) with mapi id 15.20.6178.041; Mon, 27 Mar 2023 09:54:27 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH 3/4] Btrfs: change wait_dev_flush() return type to bool Date: Mon, 27 Mar 2023 17:53:09 +0800 Message-Id: <3e067c8b0956f0134501c8eea2e19c8eb5adcedc.1679910088.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: X-ClientProxiedBy: TYCP286CA0123.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:2b6::11) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|MN0PR10MB5981:EE_ X-MS-Office365-Filtering-Correlation-Id: 60b50bf8-24fc-4cbf-3e36-08db2ea940ba X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vB5zV5qpwOF4T13ywjQU3na8E4j/0OAIZz6oC+g9/6wUhaSOAbxQ3rfm5nrMXPDW9c12NpsJMW+kR6AA2OBG6z96hxmVaww74a3neVe8GIpd4F6RJOT1UisnGzPNJQGePC2w6i2OzbFp+kINbmdv+uIdhGUlxRKz/qJU5TTViuXhVEe8J0eQu8911B+LcOi2j/n4qWuJ+Xaamx1gpGahvr8oC51lDsCk2l1GpqRfWVXc8VuEg/+crZzQKNJipSy51Kfhq19tUnZDkyIP2dTF/9SnnbrrvB8i2s+GzBi8pniPovzbYEKtUJto81o70iRWzA3EfprpRCi5Py71VO19CPOPWaTEB21HGWPSM1D9AjkLTqWkKqhlAalBjtO3TWsfPYuKd97GNJPCKOw8t0R7Vc8+vQe8biEdNRPVnoAr2Gw1qNZnGubUUfsBFaUd/9dHPdPpqVeFrEQLEF3SKFLwPXAkjU7WzH9uBqqhha2ziJriUob8acqk2XQI6ceP1EPryqFsKhX/2tEHkcQ/uhigdyVkvy6j12hbo6cYT0TF0GE0soGgAnbW5QSgrnUkx/Kw X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB5706.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(366004)(346002)(376002)(396003)(136003)(39860400002)(451199021)(6486002)(478600001)(6506007)(6512007)(186003)(316002)(8936002)(6666004)(107886003)(41300700001)(5660300002)(2616005)(44832011)(83380400001)(2906002)(4326008)(38100700002)(6916009)(66476007)(66556008)(8676002)(86362001)(66946007)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iO0dWBKuxjE10ihRTz61k5RDoLM47J0ATyqqR34ecAn5PGXDoLL3dRoU/V9xagMDubNZGGbI6BDQYUeVIZYqDNlwgHM3XbgcaaTW3qSSw3CP4TsuHbvtlbdl2lyqeH1NsVnxQMRyexWTultjD4uNexMdJz+V+nUNqziGt07c4uwnuYVxEXWe2V3mXryoLYUqDh5G1acRNWwWd8x+Dje8WBC2O7g5TP/xY+N62KfWIO0MPqpN2L4HpAlwCBQgdtcK0SLilyUEC/qEdlm2ZlZbtMaLXMTNBysxxXM6pJ+Ug709Yo1D80nxNvi+2M5rdzrquMt40r4lbXJAfikpexcimR70H8g3j+bj/6BqXXengV47xGvAM0XQekhm7XJhu+Rhde/5wKyCgeDlCJ3Qt/mWsW8UobVSmqSU4MjGC096xhiecPaKW3Z0MgAwj4/74I4e5AbbE4Q9TXwJw1CByuXHNdVphx+irsTEbrvkHXAAYqdV/6fz7b+Z1CIxbCnnOrpkxhNbjsDDCTvE1qD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jELbX+WL+eavfS8/kZHzoglY9jB9VAgda0QRs= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 7z6w/EKnEouTa/qyuKLvsVG9mcsAtg6BpxQzM+lczAtm4hdBuVbHi+BZ+pKmczKSiUfjwE1EovdLB2M9Yh61ZjZRAiEpu5rQvcSkPL9MMFdJoKmQf2tcrFqPfxa0IqTnzcHqzqj7OB7jGLPQEX8umga+wcCtkfg0HbRK+zmcDv3Mmp4tY9M8OCMXsNsqDZVMA9cS8ES1dmitU+M/5d3vRngtuDJAmft7kBirt9Hci9IBQOsmYmE25xTayGxSn4r9thxolm5gM3PyJlS5ZE+a3DN0Wdz8IUjf7/sr+FSYvUnxQE9BKtxdd3M3Ux1xflo0nweBC3hKawmOqRMpMUASSX1jfPqSz7GBDm9BWHpdGJ67qmecI0zojZNLLeiDmrnOP5cERk4OrEVErYiJh0Ir2uNdcegcYNtTeKdKf5E/Ai79/x8kQk+ej0xxIV7G8n2tbPl9fX1gbY5LCvJpggTbuFvpc0vRl2ntXUnRYDJOGSLyqg7Td+Ndtaht/j6W5tB9rn7j8lAnAJjSue4YwwW619xyOBlTHBpoEOeUqNjQiMnw5Z/qfOxqDdjSU0ucgZkXXC1OgPOhMaK6YbTCEasmeXFCGAYdQMowwhkQlWH5fShay0wJKzTu/oFyDyVh9gqQoPz4welyfFlBpXLtQ6t/56zSBlpLAIvIdBMROG2dBaSZbJy7hIN+2Zsj+Vf4iNi7lu5t09er1iuWu4caQr1ZxKcV8RCHA4GpbcdPKwkuy6xSupp1qPMfvxFwnjAiD3hvkb+xBCFhvYTxDWcDpKK6Vg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 60b50bf8-24fc-4cbf-3e36-08db2ea940ba X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2023 09:54:27.4292 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: DS7Mc8zvO82AbQP0wXGIqo4J0g6WKcha7V2Pda+f1pMepkCpop3VoQvDID6uKKySodTI2+L0Uy/u30Y5qHjN0g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR10MB5981 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-24_11,2023-03-24_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 adultscore=0 suspectscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2303270080 X-Proofpoint-GUID: jZ7k6GiA0VcwM2IXEjJi0Hx6oVZCAFHf X-Proofpoint-ORIG-GUID: jZ7k6GiA0VcwM2IXEjJi0Hx6oVZCAFHf Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org The flush error code is maintained in btrfs_device::last_flush_error, so there is no point in returning it in wait_dev_flush() when it is not being used. Instead, we can return a boolean value. Note that even though btrfs_device::last_flush_error may not be used, we will keep it for now. Signed-off-by: Anand Jain --- fs/btrfs/disk-io.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 745be1f4ab6d..040142f2e76c 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -4102,13 +4102,14 @@ static void write_dev_flush(struct btrfs_device *device) /* * If the flush bio has been submitted by write_dev_flush, wait for it. + * Return false for any error, and true otherwise. */ -static blk_status_t wait_dev_flush(struct btrfs_device *device) +static bool wait_dev_flush(struct btrfs_device *device) { struct bio *bio = &device->flush_bio; if (!test_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state)) - return BLK_STS_OK; + return true; clear_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state); wait_for_completion_io(&device->flush_wait); @@ -4116,9 +4117,10 @@ static blk_status_t wait_dev_flush(struct btrfs_device *device) if (bio->bi_status) { device->last_flush_error = bio->bi_status; btrfs_dev_stat_inc_and_print(device, BTRFS_DEV_STAT_FLUSH_ERRS); + return false; } - return bio->bi_status; + return true; } /* From patchwork Mon Mar 27 09:53:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13188983 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 7D15BC7619A for ; Mon, 27 Mar 2023 09:54:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233069AbjC0Jyq (ORCPT ); Mon, 27 Mar 2023 05:54:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233105AbjC0Jyl (ORCPT ); Mon, 27 Mar 2023 05:54:41 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85DC94C15 for ; Mon, 27 Mar 2023 02:54:37 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32R9nDR0011081 for ; Mon, 27 Mar 2023 09:54:37 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 : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=VQNqkb5yLbBMOdXK7+/jokwj+D1qW76d+kpT+ypIegI=; b=12C63Am9iO5qwRrXBgsU0xmm1Y8L8X22xFda+B1dkCr2KHucP5V4DnTsRTutw6SAMEsy Ytc4gcCqQOUH+UhHR0G9ivo8c7Nk194iXtZIKc56Am6dBk4uMZ2fmlUOgZMwzbVduIan gwlWhjZDiKf9bhv0V7zHsMJVNbi+M0L3AVtWYvQBQX6MIQqtdjcibEAg4MPB9krqsLgT BlRMW2L8m8VVVL7X/Q6TF8A1WGHtLixo6vuzTeMNzWjh5W9vt0MJt6yfOt4Kx3AZFLVo q7/b6qLJ222+yfvjsYetQRaOVE43eF5MC/T3L2XWnMGtY/QMzDUcqW2p/aR6hY0oGq8P BQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3pk8ug00hj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 27 Mar 2023 09:54:37 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 32R80wEr009240 for ; Mon, 27 Mar 2023 09:54:36 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2044.outbound.protection.outlook.com [104.47.73.44]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3phqdb0txj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 27 Mar 2023 09:54:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QerjDzRtRmIEwXWKMFFoXTaPJxXcKd52fMFtYbPprpCRtOZakJx3zDfwIt9vkQFO5FUzeRvgB6kjwnwOf6umYLY/gGk6j+/Gv9yzd5G+BAa0RD935AABBbheyHqs5nRJpKNUWq1e8LxdZwn/a3PIM5/pklgz/3VpDOs7IdhED157hGeKvu21NtSMnJehthRq6B8YNsLEtfrWL/ij4UwQC/Nv1rf3JZvf8EL+AyPQ+f4a4ibICxPdxU1eVj4QIyjupsaiKeKqXC4/v0wnwqyPdl7LLaUz4uG8dH5VC369ohxwhO1/fptO53WPr7qunKqZ5gjJwuBQE2+CyS5LxijM5w== 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=VQNqkb5yLbBMOdXK7+/jokwj+D1qW76d+kpT+ypIegI=; b=YXEWYkdWoOfzbVGkMmxisLZEQCOOWd/wLWI/kCvqLfa818jnZLdit8dtH5xXbAEqkbTD+V+ejmsxSGDzsSjCfwgTSFINcmW5u2MojY1xNbZd2UYQHuMLK762unBHTmcRjT5DrrKbBMB4hVlHqYKpTaew3JwknSsZdzqLGd4YIexz8GONkBtAKE1jGx4JPLL6hHCwZ20G3lUaJ690u7PzjrF50e7agUV7adCLZm4R6deRJWfdexC4jXL4mgbzaiah/LfyhB7VsTZgpbT0W81k9GBQfzi+m8vWJzLXrp0idksHVHzmc1MZaxjmeQ6oz3a+q1WWQ7+ygQHjGF/qo86jdQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VQNqkb5yLbBMOdXK7+/jokwj+D1qW76d+kpT+ypIegI=; b=oLcIiiQB46W+1RNHt6S+g9LW87qSELSR5KTlC0EzL0WbCSIcoWucl/YbBFXbMGm3vJ+2m296P0YSoRHphSdHiWY1IfUEU6RLGGCk1VjuYh3et5n6NBE1/ZcfRzFaiUWgtxstpIao+wJ8xZoOXV/T5zSjOPlb35Owb+Kk2bQcwJY= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by MN0PR10MB5981.namprd10.prod.outlook.com (2603:10b6:208:3cb::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.41; Mon, 27 Mar 2023 09:54:34 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::3eb1:c999:6a64:205c]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::3eb1:c999:6a64:205c%6]) with mapi id 15.20.6178.041; Mon, 27 Mar 2023 09:54:34 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH 4/4] btrfs: use test_and_clear_bit() in wait_dev_flush() Date: Mon, 27 Mar 2023 17:53:10 +0800 Message-Id: <7baf74b071f9d9002d2543cfc4f86bd3ddf7127f.1679910088.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: X-ClientProxiedBy: TYXPR01CA0045.jpnprd01.prod.outlook.com (2603:1096:403:a::15) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|MN0PR10MB5981:EE_ X-MS-Office365-Filtering-Correlation-Id: 245ea99b-9a7c-4158-5640-08db2ea944d8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EH3AdrDRb1CVzsr2l5peAGe+5p4gpD+BTKf2nWorBaSBOae8allMUByAYZTwYzcHdVvhFSgIdX2ntS9cZkUcIoSO6CxVn2ggU197MQ4g4vjXJKy0wA5fx2pl6dGqap2TBahC6VH5mABccPEeQXPqJnJxd2xClBtXgpEj+FD07iYpp1iB6zjhaSEj8Obbs/su/ufapKgcYeI/DgLtOZ7bJQrpWVVeKIoGHVNq+0zjq+wtwydJiFBon+FGsEZ50bEyYICbo1GEFuOKf+6TzU170Y7vYPdlm7iFKsGbhvTFUwvn1LWsHM441gbPbvwnJmcs3EQxph05Zm9HPlBqSfVOnkT77bkNPkU72CO6DnnUhKaEY1dgLnLawhDEirt0iT/AG3HW2T1p+dn8cBM6ONWBLDWUY43nz/FmXLG7J0H2Ogqfu72NRP5gMYsTiQIbBVd3kSvPh5jhApv0sm/OSnJtYXeozkHPErqEwJgigcur0nmmr9Fqn69BDyF7AckelUBN4iSES7yQjIBjECZ6I6bkgS9CwvCA+GgvTn6I6JZ9oE4Vo6SrgCtf3S1sAS0b8OV4 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB5706.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(366004)(346002)(376002)(396003)(136003)(39860400002)(451199021)(6486002)(478600001)(6506007)(6512007)(186003)(316002)(8936002)(6666004)(107886003)(41300700001)(5660300002)(4744005)(2616005)(44832011)(83380400001)(2906002)(4326008)(38100700002)(6916009)(66476007)(66556008)(8676002)(86362001)(66946007)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rWvkGS2z/fjt+bO1Uxro1brdDi3dZTVk4LbtdF1f6byZbahZ/YXx64U9UjpaTCP1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2MjAAjVvFs/WOZz4v4KlNKZTi/oD+296hfRQB736CpacVS86WHbHweCK0PNFnJLY2QrEOtNSVx2CAJ+wPC5yO+gkhJ4j28SqxdmZu0A8wpojSWx+G6q54hOg1PwQusFLwnbO8XbHSpM5BDZXP5lyolvct/ys+M0RJLkQzbDAKui8UyePvsSizC34qCU0b5fEenOeFIU69xU8Cz7znMLXwQiWjUaM9IYkSVKWtu7Y+e3sh8d5uQ55++QmEhvwd78vVjCtZkncHq6GvNLfRJSGleo+sZDMoZEutJz/USs7gVlLXQArOi+w== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 245ea99b-9a7c-4158-5640-08db2ea944d8 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2023 09:54:34.3373 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1dy3gyCfTiWYXglY397u8YOYC1kWjDL8PPRZB3o+jd9T8eEJyFp9htllRyY9kQgWD52evdzJBT4gV5TecE7KSw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR10MB5981 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-24_11,2023-03-24_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 bulkscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2303270080 X-Proofpoint-ORIG-GUID: i2CNqcmufZZCQCUsUUX7hQxNXpyNDhlM X-Proofpoint-GUID: i2CNqcmufZZCQCUsUUX7hQxNXpyNDhlM Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org The function wait_dev_flush() tests for the BTRFS_DEV_STATE_FLUSH_SENT bit and then clears it separately. Instead, use test_and_clear_bit(). Signed-off-by: Anand Jain --- fs/btrfs/disk-io.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 040142f2e76c..1f9e2a2a8267 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -4108,10 +4108,9 @@ static bool wait_dev_flush(struct btrfs_device *device) { struct bio *bio = &device->flush_bio; - if (!test_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state)) + if (!test_and_clear_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state)) return true; - clear_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state); wait_for_completion_io(&device->flush_wait); if (bio->bi_status) {