Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp423991pxj; Thu, 10 Jun 2021 04:18:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwW614BM46T5gC8A2lfbZImSWcT1+8BGYjh0f8QtLEmmYSjp/mvpzUcw+rMJA6ebeoGyBLu X-Received: by 2002:a05:6402:201:: with SMTP id t1mr4136084edv.149.1623323922172; Thu, 10 Jun 2021 04:18:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623323922; cv=none; d=google.com; s=arc-20160816; b=aQatEiIdPlZHaMuN8IuYlng40DzY+RKadhAD+p4CrDfdQp4cwrGYycfRVNi0nbJ6tP G0TqmhgQ/9mP8G3tv5BssbirXKOo5mtCg3183uD/gTPBrr2ni7L9kBP1LnnzCyBXbR1u eaz8EH/D7TS72aj3RmJPUlvVkmknjSt4cDupPw25sx/oXsV2pRGzmnVW0s3dv8Sy+pOR R1eNb9pF2AdtRa51JnGFRjhYWZ9UHOebqXWDarFJQc/gGzPZkGDUpiC1jFKI4g4UrMI1 n66zXHLhHEph+MWA4inJGt+3QrOZoYgLB7CGRC5THTwpLHlmsSmTWYtsmlYL8I7Gb0Mi HkRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=v2NAFguhShvvL/NQq44azieoAe5IO75rUD5NfnfoYjY=; b=K0rDrVPTWylwdi/yD5NsddE0g+sliBAjABAqVbD5qhUch4XZ4cBNbY163+ignm1kAc 23Df1IRFNBEMzJRLv58CpKKH4R2omzTz7wvFw+zFlnlRM6q0wX+PwaohtWKh3GfZ9rJW lxcw3xiVH5mRUxiHEjLmSuu10tOpU1vK2jBQSZMGVTi7O4IMv3DvkCcoB7tkJpY27VZN 7mSBxpM422RKdDV53O+pdo/sMMU/zlvm5g3ksMwYBUk3YsreXStiNvJDYxQ4WkngNF5C A0nqxalbaG1KC+Z7ZPju9p8nPU4G31c5JJkFCq2P+DJzzsVGcf9m8VL/iJ3LIzfHVFHK o/YQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z13si2096426ejl.2.2021.06.10.04.18.17; Thu, 10 Jun 2021 04:18:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230244AbhFJLRy (ORCPT + 99 others); Thu, 10 Jun 2021 07:17:54 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:5487 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229961AbhFJLRt (ORCPT ); Thu, 10 Jun 2021 07:17:49 -0400 Received: from dggeme752-chm.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4G11Y930HPzZfZw; Thu, 10 Jun 2021 19:13:01 +0800 (CST) Received: from huawei.com (10.175.127.227) by dggeme752-chm.china.huawei.com (10.3.19.98) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Thu, 10 Jun 2021 19:15:51 +0800 From: Zhang Yi To: , , , CC: , , , Subject: [RFC PATCH v4 4/8] jbd2: remove redundant buffer io error checks Date: Thu, 10 Jun 2021 19:24:36 +0800 Message-ID: <20210610112440.3438139-5-yi.zhang@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210610112440.3438139-1-yi.zhang@huawei.com> References: <20210610112440.3438139-1-yi.zhang@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggeme752-chm.china.huawei.com (10.3.19.98) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Now that __jbd2_journal_remove_checkpoint() can detect buffer io error and mark journal checkpoint error, then we abort the journal later before updating log tail to ensure the filesystem works consistently. So we could remove other redundant buffer io error checkes. Signed-off-by: Zhang Yi Reviewed-by: Jan Kara --- fs/jbd2/checkpoint.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c index d27c10f4502f..75a4f622afaf 100644 --- a/fs/jbd2/checkpoint.c +++ b/fs/jbd2/checkpoint.c @@ -91,8 +91,7 @@ static int __try_to_free_cp_buf(struct journal_head *jh) int ret = 0; struct buffer_head *bh = jh2bh(jh); - if (jh->b_transaction == NULL && !buffer_locked(bh) && - !buffer_dirty(bh) && !buffer_write_io_error(bh)) { + if (!jh->b_transaction && !buffer_locked(bh) && !buffer_dirty(bh)) { JBUFFER_TRACE(jh, "remove from checkpoint list"); ret = __jbd2_journal_remove_checkpoint(jh) + 1; } @@ -228,7 +227,6 @@ int jbd2_log_do_checkpoint(journal_t *journal) * OK, we need to start writing disk blocks. Take one transaction * and write it. */ - result = 0; spin_lock(&journal->j_list_lock); if (!journal->j_checkpoint_transactions) goto out; @@ -295,8 +293,6 @@ int jbd2_log_do_checkpoint(journal_t *journal) goto restart; } if (!buffer_dirty(bh)) { - if (unlikely(buffer_write_io_error(bh)) && !result) - result = -EIO; BUFFER_TRACE(bh, "remove from checkpoint"); if (__jbd2_journal_remove_checkpoint(jh)) /* The transaction was released; we're done */ @@ -356,8 +352,6 @@ int jbd2_log_do_checkpoint(journal_t *journal) spin_lock(&journal->j_list_lock); goto restart2; } - if (unlikely(buffer_write_io_error(bh)) && !result) - result = -EIO; /* * Now in whatever state the buffer currently is, we @@ -369,10 +363,7 @@ int jbd2_log_do_checkpoint(journal_t *journal) } out: spin_unlock(&journal->j_list_lock); - if (result < 0) - jbd2_journal_abort(journal, result); - else - result = jbd2_cleanup_journal_tail(journal); + result = jbd2_cleanup_journal_tail(journal); return (result < 0) ? result : 0; } -- 2.31.1