From patchwork Mon Jun 20 05:58:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ritesh Harjani (IBM)" X-Patchwork-Id: 12887010 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 78E07C433EF for ; Mon, 20 Jun 2022 05:59:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238407AbiFTF7d (ORCPT ); Mon, 20 Jun 2022 01:59:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238399AbiFTF7c (ORCPT ); Mon, 20 Jun 2022 01:59:32 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAAE8DF9B; Sun, 19 Jun 2022 22:59:31 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id p5so3477954pjt.2; Sun, 19 Jun 2022 22:59:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Dnr960qYxA6UYyUxCbuhVR96hMUWIp2ji8PopCctuLU=; b=Wl6kiBUznii/2rYkU/1Zxwa7/7osUmh8SDL6VDObtNhM55aEWaW4g/hYF1p4/IhzSo 0YStTRq53FPmkiXsOUFWtEP/4IThAKEDlW1N/lv+3oa/wE8vZ5ej7hLMyki6c/+n2lXX TcvSnJPwJyuBVpgS7A8s7xWm5DK5SbRuB8s0Zi0o2gV+RQs6nPTWp5QRZmhDVamAGeG6 ALRROg/GgDxY9xJ8rAPLtV6Z6I0/JOcRG/jGgG+yxshdFVS6gMKSrVSXMXfLOJrRylQr 7c6uwVHA94yYVDLZ7rnWy4SwV2/GosGcNdYOb6txXnqfjKtW625F9aK9zvBKcDDxIs0A oenw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Dnr960qYxA6UYyUxCbuhVR96hMUWIp2ji8PopCctuLU=; b=LxamDfumLAmOUoCOJH3j8Hlpqc1hSqhpmE5Q5+Di5L9uRtg9g+9Rh145hfTSilaN20 9/xz6nkVPDaZbp95e995FhPKZpUjJ3R4XjQhLXjMTaQXyg0+VmM49nTGdXPphaogZpek fOw7XD+/9eKb0foVV+b4rAsRwEfhxA4tGFKBj1/xm7uP9eh2wwH0eLNFcoQvq/CE90di VVWzn9ghvwrtcFom/jp+gHNdRsKwRE7jwYXI4tjj42W/i1VAVuo7jMmyAwds27E/+STF 8x+I/NRKlGwwFGDWKAEugYKy+n4MEV41x53cVbHTsHkhVbrrbaaohnkuWsDRD27FnpOF Go7w== X-Gm-Message-State: AJIora+bQk5qqA8NecJjpC/8xJ4wRztE4LDAFU3PDRa85szMRCW3gMIX eUlpsLCaxkcP54DFEeiF7N5CUnguLs4= X-Google-Smtp-Source: AGRyM1uIVSlutSBbHKE2G7Q9EcbbSNaZn7Ddzo5S4iaDXG+kbfbw24ABlH+2pguuL3ZGIoY2VX4h6w== X-Received: by 2002:a17:902:7686:b0:168:de55:8c45 with SMTP id m6-20020a170902768600b00168de558c45mr22155079pll.129.1655704770834; Sun, 19 Jun 2022 22:59:30 -0700 (PDT) Received: from localhost ([2406:7400:63:5d34:e6c2:4c64:12ae:aa11]) by smtp.gmail.com with ESMTPSA id g12-20020a62f94c000000b0050dc76281f8sm7968901pfm.210.2022.06.19.22.59.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jun 2022 22:59:29 -0700 (PDT) From: Ritesh Harjani To: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: Jan Kara , Alexander Viro , Ritesh Harjani Subject: [RFC 1/3] jbd2: Drop useless return value of submit_bh Date: Mon, 20 Jun 2022 11:28:40 +0530 Message-Id: <57b9cb59e50dfdf68eef82ef38944fbceba4e585.1655703467.git.ritesh.list@gmail.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org submit_bh always returns 0. This patch cleans up 2 of it's caller in jbd2 to drop submit_bh's useless return value. Once all submit_bh callers are cleaned up, we can make it's return type as void. Signed-off-by: Ritesh Harjani Reviewed-by: Christoph Hellwig Reviewed-by: Jan Kara --- fs/jbd2/commit.c | 11 +++++------ fs/jbd2/journal.c | 6 ++---- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index eb315e81f1a6..688fd960d01f 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c @@ -122,8 +122,8 @@ static int journal_submit_commit_record(journal_t *journal, { struct commit_header *tmp; struct buffer_head *bh; - int ret; struct timespec64 now; + int write_flags = REQ_SYNC; *cbh = NULL; @@ -155,13 +155,12 @@ static int journal_submit_commit_record(journal_t *journal, if (journal->j_flags & JBD2_BARRIER && !jbd2_has_feature_async_commit(journal)) - ret = submit_bh(REQ_OP_WRITE, - REQ_SYNC | REQ_PREFLUSH | REQ_FUA, bh); - else - ret = submit_bh(REQ_OP_WRITE, REQ_SYNC, bh); + write_flags |= REQ_PREFLUSH | REQ_FUA; + + submit_bh(REQ_OP_WRITE, write_flags, bh); *cbh = bh; - return ret; + return 0; } /* diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index c0cbeeaec2d1..81a282e676bc 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -1606,7 +1606,7 @@ static int jbd2_write_superblock(journal_t *journal, int write_flags) { struct buffer_head *bh = journal->j_sb_buffer; journal_superblock_t *sb = journal->j_superblock; - int ret; + int ret = 0; /* Buffer got discarded which means block device got invalidated */ if (!buffer_mapped(bh)) { @@ -1636,14 +1636,12 @@ static int jbd2_write_superblock(journal_t *journal, int write_flags) sb->s_checksum = jbd2_superblock_csum(journal, sb); get_bh(bh); bh->b_end_io = end_buffer_write_sync; - ret = submit_bh(REQ_OP_WRITE, write_flags, bh); + submit_bh(REQ_OP_WRITE, write_flags, bh); wait_on_buffer(bh); if (buffer_write_io_error(bh)) { clear_buffer_write_io_error(bh); set_buffer_uptodate(bh); ret = -EIO; - } - if (ret) { printk(KERN_ERR "JBD2: Error %d detected when updating " "journal superblock for %s.\n", ret, journal->j_devname); From patchwork Mon Jun 20 05:58:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ritesh Harjani (IBM)" X-Patchwork-Id: 12887011 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 56E5DC43334 for ; Mon, 20 Jun 2022 05:59:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238416AbiFTF7k (ORCPT ); Mon, 20 Jun 2022 01:59:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238421AbiFTF7i (ORCPT ); Mon, 20 Jun 2022 01:59:38 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03995DFA6; Sun, 19 Jun 2022 22:59:37 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id 73-20020a17090a0fcf00b001eaee69f600so9278207pjz.1; Sun, 19 Jun 2022 22:59:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Clel/4ybCmI1HGYhwncCodVfekWAtcomQbTqtWI+l0Q=; b=YAbbkPY7AQqeGcoSQY/GDuPZ4RakV3S3JtVdiT2WDFxLmyHoRq5stiZIPZJQrz38ij P/U3fSbE00vIjIHK4rt9r8bZfVgbj/q729TbMOppW0sppD0HnGp0tDEFSQfroVrjhwQ9 Giyx24RXA9ySH70qRJUqmFGCvf21GQq5ehjsyTP8RPHcbORmTOvdY/48P6TbsaR4yMUx RjBV91bdyTjNUh1xl7G3GK5eDIYI8lYVTBoA7Jzj3Q6k2G3Ndzui4qpOdvYLb+h6xzfQ NRLXJ+L5tpLsb95d9nh6c5pe1OrCnP3pSb9bLwWD71nd+wOXQDzZxIZ/vTajbb//xPdp hhOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Clel/4ybCmI1HGYhwncCodVfekWAtcomQbTqtWI+l0Q=; b=q8eU6YYCAQF+Fr0ioRJbxHRv6NXvPb4CQrw46ekt+XbF0LU3IQ/I6BkNs9MsFMMVBU NUdGUjt6g0BQkKZgFrGi0Ue6K1Tv9NqMPd3jA31A/NnQIwJXCWVoIYxV49xF3ohsGRa6 K6gxR1FU+P6PisDDP781b2OSeuk9LeKAt1Do2wzdUCP36Gj4XwZGuzGIN9UsiEDhbneW MR3IhzH4vTTljIjLqGpurOy/g7ups2FMZdBwFhTyG1sNbei/7ELznLli5uD5TZLp9WS2 4n43RRLJpIntESDEk6UppMBJeMTAV98d8mzQFU2z7ViV0CF1UH43nDyMYqxNhp8Y6thr 5I4Q== X-Gm-Message-State: AJIora+T5Vv0lWfEbwbe71gjvb4IEZZHB7cJGaIwqm5td3MHCcPYajDA WyW6Tq6rxqZuhqbEVgHTHEDYe1AhN/M= X-Google-Smtp-Source: AGRyM1uHcTMDgy+sugVksf12u0TC4QU4EKjkQc/KOyYn8vDa4EfP6+m+gPhbCIDrfNe7V1K+GoXwnw== X-Received: by 2002:a17:903:240e:b0:168:ea13:f9e0 with SMTP id e14-20020a170903240e00b00168ea13f9e0mr22599116plo.6.1655704776327; Sun, 19 Jun 2022 22:59:36 -0700 (PDT) Received: from localhost ([2406:7400:63:5d34:e6c2:4c64:12ae:aa11]) by smtp.gmail.com with ESMTPSA id v20-20020a17090331d400b001641047544bsm7709664ple.103.2022.06.19.22.59.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jun 2022 22:59:35 -0700 (PDT) From: Ritesh Harjani To: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: Jan Kara , Alexander Viro , Ritesh Harjani Subject: [RFC 2/3] fs/buffer: Drop useless return value of submit_bh Date: Mon, 20 Jun 2022 11:28:41 +0530 Message-Id: <77274d2a2030f6ee06901496f9c5fbe8779127a3.1655703467.git.ritesh.list@gmail.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org submit_bh always returns 0. This patch drops the useless return value of submit_bh from __sync_dirty_buffer(). Once all of submit_bh callers are cleaned up, we can make it's return type as void. Signed-off-by: Ritesh Harjani Reviewed-by: Christoph Hellwig Reviewed-by: Jan Kara --- fs/buffer.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index 898c7f301b1b..313283af15b6 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -3121,8 +3121,6 @@ EXPORT_SYMBOL(write_dirty_buffer); */ int __sync_dirty_buffer(struct buffer_head *bh, int op_flags) { - int ret = 0; - WARN_ON(atomic_read(&bh->b_count) < 1); lock_buffer(bh); if (test_clear_buffer_dirty(bh)) { @@ -3137,14 +3135,14 @@ int __sync_dirty_buffer(struct buffer_head *bh, int op_flags) get_bh(bh); bh->b_end_io = end_buffer_write_sync; - ret = submit_bh(REQ_OP_WRITE, op_flags, bh); + submit_bh(REQ_OP_WRITE, op_flags, bh); wait_on_buffer(bh); - if (!ret && !buffer_uptodate(bh)) - ret = -EIO; + if (!buffer_uptodate(bh)) + return -EIO; } else { unlock_buffer(bh); } - return ret; + return 0; } EXPORT_SYMBOL(__sync_dirty_buffer); From patchwork Mon Jun 20 05:58:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ritesh Harjani (IBM)" X-Patchwork-Id: 12887012 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 015F1C43334 for ; Mon, 20 Jun 2022 06:00:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238426AbiFTGAD (ORCPT ); Mon, 20 Jun 2022 02:00:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238421AbiFTF7s (ORCPT ); Mon, 20 Jun 2022 01:59:48 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41F00DF8B; Sun, 19 Jun 2022 22:59:42 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id w24so933907pjg.5; Sun, 19 Jun 2022 22:59:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NYiD9eM+KGyPorgMmWX5XLuH3KZcPdxGd9EsYZHUhiY=; b=TrRaOOhpUEndVxuD7aVjtYiXelfTK4XWG/0UTWd1A0E2ycgpEs7qlg9TaEx77TCFEc baphQ6gYwfuGcaFW1uv9HkJ3ia7bMpYFJUC+EFXB+YEZjg4jK5eu/mqtXfkMMfEox3ME XmNUeGHBcjv5CfQt2sNEkfHVoK0+fj13XjXK9XyJQSvigZ1jwDbVlU0JljdqS1D0ongQ JjgdX228kh67cwnRpKKbSz+aeF4sCxi2TFcIuD2+NpvBJUIKLXJGWcWclIfDuM5oqhYu SCkVKT2LxHhTiOFTW5s6/wQCEEJFJ/corEIWHYHez0WfNSNPSObJv+rV8g4EHBUweozF e4HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NYiD9eM+KGyPorgMmWX5XLuH3KZcPdxGd9EsYZHUhiY=; b=gi/0K0ZJDtRlBdMaHZAwsEIoeJQFZMkG/bOWBjLp5StBmqgrn4xz1avGWqDBQNoPD1 MGBa8qGF2E0o5b6BQUdYZJCtLh48OfrobFVlKoJYBjmzfiRQDVd0BRqLteNRjY+AM0w2 dZmk/wGWfPYUrUYVeKf7s8TeGFcMlc51whjqDmJS4xkbIbTwfMInbpj8fGA6NxoDZ8Ys tM8NZBysBJE9Gk7toDkuXZf2O2wm5F1Cjcl/jF3yG2ZKUrEpOcVn4oLD0XZboaP2pEzl f/is2I2GDJUnkXMvWH5u2qf47M1MiMOEXNG6ki5ulmQNf/TC3WBYn4VBNQZ3tDQ2ZMSY R8Uw== X-Gm-Message-State: AJIora9ZhmrbDq0O0O9qcPyyeegTgLi3MAVZ1d8QhBdx6fw8iwj4H/oA dk2bcDxqkvQmPR9KdPcn75w3xtoxKzU= X-Google-Smtp-Source: AGRyM1sMmNvyA6tVU+E7iDcAxZ4dzRCPjegQKTiw11JwZQR8nnlK1p8eEhw5j2RBrj1oZi7BWhU3VQ== X-Received: by 2002:a17:90b:1c10:b0:1e8:90bd:d912 with SMTP id oc16-20020a17090b1c1000b001e890bdd912mr24897843pjb.233.1655704781351; Sun, 19 Jun 2022 22:59:41 -0700 (PDT) Received: from localhost ([2406:7400:63:5d34:e6c2:4c64:12ae:aa11]) by smtp.gmail.com with ESMTPSA id 144-20020a621796000000b0051b693baadcsm7934601pfx.205.2022.06.19.22.59.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jun 2022 22:59:41 -0700 (PDT) From: Ritesh Harjani To: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: Jan Kara , Alexander Viro , Ritesh Harjani Subject: [RFC 3/3] fs/buffer: Make submit_bh & submit_bh_wbc return type as void Date: Mon, 20 Jun 2022 11:28:42 +0530 Message-Id: X-Mailer: git-send-email 2.35.3 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org submit_bh/submit_bh_wbc are non-blocking functions which just submits the bio and returns. The caller of submit_bh/submit_bh_wbc needs to wait on buffer till I/O completion and then check buffer head's b_state field to know if there was any I/O error. Hence there is no need for these functions to have any return type. Even now they always returns 0. Hence drop the return value and make their return type as void to avoid any confusion. Signed-off-by: Ritesh Harjani Reviewed-by: Christoph Hellwig Reviewed-by: Jan Kara --- fs/buffer.c | 9 ++++----- include/linux/buffer_head.h | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index 313283af15b6..6671abc98e21 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -52,7 +52,7 @@ #include "internal.h" static int fsync_buffers_list(spinlock_t *lock, struct list_head *list); -static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh, +static void submit_bh_wbc(int op, int op_flags, struct buffer_head *bh, struct writeback_control *wbc); #define BH_ENTRY(list) list_entry((list), struct buffer_head, b_assoc_buffers) @@ -2994,7 +2994,7 @@ static void end_bio_bh_io_sync(struct bio *bio) bio_put(bio); } -static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh, +static void submit_bh_wbc(int op, int op_flags, struct buffer_head *bh, struct writeback_control *wbc) { struct bio *bio; @@ -3037,12 +3037,11 @@ static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh, } submit_bio(bio); - return 0; } -int submit_bh(int op, int op_flags, struct buffer_head *bh) +void submit_bh(int op, int op_flags, struct buffer_head *bh) { - return submit_bh_wbc(op, op_flags, bh, NULL); + submit_bh_wbc(op, op_flags, bh, NULL); } EXPORT_SYMBOL(submit_bh); diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index c9d1463bb20f..392d7d5aec05 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -205,7 +205,7 @@ void ll_rw_block(int, int, int, struct buffer_head * bh[]); int sync_dirty_buffer(struct buffer_head *bh); int __sync_dirty_buffer(struct buffer_head *bh, int op_flags); void write_dirty_buffer(struct buffer_head *bh, int op_flags); -int submit_bh(int, int, struct buffer_head *); +void submit_bh(int op, int op_flags, struct buffer_head *bh); void write_boundary_block(struct block_device *bdev, sector_t bblock, unsigned blocksize); int bh_uptodate_or_lock(struct buffer_head *bh);