From patchwork Sat Apr 20 02:49:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636930 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A578F79DD; Sat, 20 Apr 2024 02:50:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581450; cv=none; b=KSdOonYWgalh/jf4Zycya4tqdhJEvgHG43SY66m2U+0MNh7qGgDH34B9D7R4LLmAc7WqHXafl3y0fZ79nQLZPr/cPux/QGCLW0FvU2OEnZYlu5F05Hr/Ur647mbetlHRmR0iyOyw7aNfsLZEXYOIXPzASoEC7OVx/Ly83QQ/JPQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581450; c=relaxed/simple; bh=4MwBE7u5de5BF4nUaoFf4BqiiTWYHEGiETIg6CUpGNc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=N4JOplB1Y7MNRqMDLbfoHEupwLCqMYkPhrV0VEGu7XlRJg8J5ipw85jpb6EwxXfR8uZksriCG14TWp2LxxBY3pJA2TNttDY5FiBsOWu9HRduCIU8fCOyeyrPrqk+1NEsGwMcYijFznKJbjsiVmNP+EMnjoMbt8bydsUKolp+6sM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=SHDbkDdU; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="SHDbkDdU" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=eZyFacoFWlUHyNqrE7n/pQQL9VwstpBC8fVXbXaKtgE=; b=SHDbkDdUXYYhOmhVhYt8AuK0Tm WVxf22XfwmYx0s7guJf+stOq9LBuUgrpIIR3A9vfvIMJC8X/MTk87iVoKUlkoZSLlQ0nytX+y1cVj 2ANfN7CXd3bJW0OKIVyxxpznqc4+tA4HxljCUW1/NqWZjbIujAL2q5tDdvaDcgwBpSt9/3r+QhlpL 1pfwRTriQRgK3VGIyS+FQWstMaDiO+I11uC9Om8f/Ay8wFlwgMRgu6+b6enWHYjSdVYmnFhVnUUZN BrL9LCA0RcI5ukfmUcmAQ1HVkhnWGv9/oiiYr6XxIDuiM3oSTQwMyTMVx4Ckaqhd3Rhz/m9Yt9e4k luhV/yAw==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0oO-000000095e1-1H9I; Sat, 20 Apr 2024 02:50:44 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org Subject: [PATCH 01/30] btrfs: Use a folio in wait_dev_supers() Date: Sat, 20 Apr 2024 03:49:56 +0100 Message-ID: <20240420025029.2166544-2-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Removes a few calls to compound_head() and calls to obsolete APIs. Cc: Chris Mason Cc: Josef Bacik Cc: David Sterba Cc: linux-btrfs@vger.kernel.org Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Johannes Thumshirn --- fs/btrfs/disk-io.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 3d512b041977..32cf64ccd761 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -3849,7 +3849,7 @@ static int wait_dev_supers(struct btrfs_device *device, int max_mirrors) max_mirrors = BTRFS_SUPER_MIRROR_MAX; for (i = 0; i < max_mirrors; i++) { - struct page *page; + struct folio *folio; ret = btrfs_sb_log_location(device, i, READ, &bytenr); if (ret == -ENOENT) { @@ -3864,27 +3864,27 @@ static int wait_dev_supers(struct btrfs_device *device, int max_mirrors) device->commit_total_bytes) break; - page = find_get_page(device->bdev->bd_mapping, + folio = filemap_get_folio(device->bdev->bd_mapping, bytenr >> PAGE_SHIFT); - if (!page) { + if (IS_ERR(folio)) { errors++; if (i == 0) primary_failed = true; continue; } - /* Page is submitted locked and unlocked once the IO completes */ - wait_on_page_locked(page); - if (PageError(page)) { + /* Folio is unlocked once the write completes */ + folio_wait_locked(folio); + if (folio_test_error(folio)) { errors++; if (i == 0) primary_failed = true; } /* Drop our reference */ - put_page(page); + folio_put(folio); /* Drop the reference from the writing run */ - put_page(page); + folio_put(folio); } /* log error, force error return */ From patchwork Sat Apr 20 02:49:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636933 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7D70524A; Sat, 20 Apr 2024 02:50:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581452; cv=none; b=oR2J0iBvp0LqRCtGdCtvsjJY2TnR+oHLRMiN45XjVQCg0WTr8tqkKB6ihPasc1LvDwGPL1Y8afoJ1txhjwVg0OkNXq5CLUpWUFZhaGA3VpPzBPcfcHx49AjrwRCVR9OuNYsyMt1P/TATz5FInUFzNRlVVyhJ/jEzcBYhswFlZHg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581452; c=relaxed/simple; bh=bdWKf8RrIw6HShlQnEwTvVodOrlgX9LZsrXV0XBYPAQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QWTZzfl00zXlM0kQ+uS3+70MrQ/XjfXQZRZXQsFjsfxccZldMGuUnDdUe7lJ8QO1Ll6kJBEGT+SKvlSZW+dqnJqWBTGgKdK9ywmXAPuBjUVh/R/dwrnk+eMBw9fgYmtAZVs76FgaAAAC/Zt/lgwPdfXCDdn05celggpU1WlLx3A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=KuIBbNf1; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="KuIBbNf1" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=CpH16iYJrVZdrm6jz8AltnYLIb1as/vR4g26ErGz18c=; b=KuIBbNf1Q4CtYflEarqHZjLhTC Ig4lVttPNqmzWeOzJ+ejNByH9RpRor1t6QmL82jZwLbIyMsN1Qm/RiqPYnk635tsNUOC34jWV6oH4 nqQm/2vTmJJ5mrOIG2TOYf+SqLJv4SymOrmrMBLXO0AHanghfej1q9FmiJFUhOIaziD3HysJvXDkI IRg0GsKtbRt/cm82RANuGgj1aWReqBXGMdwOj8IHFv3ntxSBkx9pAb5FpZiCGIVyOE7azwlAtplCW z4phKDW9D+tBIcG1d8esWjQy4oz5exzZ8fa9BTv/g1gTAufLBCbFOM5auYGErkwBSGbqG3vRf6SCs 87DB+oDw==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0oO-000000095e3-3SyE; Sat, 20 Apr 2024 02:50:44 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org Subject: [PATCH 02/30] btrfs: Use a folio in write_dev_supers() Date: Sat, 20 Apr 2024 03:49:57 +0100 Message-ID: <20240420025029.2166544-3-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Remove some calls to obsolete APIs and some hidden calls to compound_head(). Cc: Chris Mason Cc: Josef Bacik Cc: David Sterba Cc: linux-btrfs@vger.kernel.org Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Johannes Thumshirn --- fs/btrfs/disk-io.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 32cf64ccd761..8fa7c526093c 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -3760,9 +3760,10 @@ static int write_dev_supers(struct btrfs_device *device, shash->tfm = fs_info->csum_shash; for (i = 0; i < max_mirrors; i++) { - struct page *page; + struct folio *folio; struct bio *bio; struct btrfs_super_block *disk_super; + size_t offset; bytenr_orig = btrfs_sb_offset(i); ret = btrfs_sb_log_location(device, i, WRITE, &bytenr); @@ -3785,9 +3786,9 @@ static int write_dev_supers(struct btrfs_device *device, BTRFS_SUPER_INFO_SIZE - BTRFS_CSUM_SIZE, sb->csum); - page = find_or_create_page(mapping, bytenr >> PAGE_SHIFT, - GFP_NOFS); - if (!page) { + folio = __filemap_get_folio(mapping, bytenr >> PAGE_SHIFT, + FGP_LOCK | FGP_ACCESSED | FGP_CREAT, GFP_NOFS); + if (IS_ERR(folio)) { btrfs_err(device->fs_info, "couldn't get super block page for bytenr %llu", bytenr); @@ -3796,9 +3797,10 @@ static int write_dev_supers(struct btrfs_device *device, } /* Bump the refcount for wait_dev_supers() */ - get_page(page); + folio_get(folio); - disk_super = page_address(page); + offset = offset_in_folio(folio, bytenr); + disk_super = folio_address(folio) + offset; memcpy(disk_super, sb, BTRFS_SUPER_INFO_SIZE); /* @@ -3812,8 +3814,7 @@ static int write_dev_supers(struct btrfs_device *device, bio->bi_iter.bi_sector = bytenr >> SECTOR_SHIFT; bio->bi_private = device; bio->bi_end_io = btrfs_end_super_write; - __bio_add_page(bio, page, BTRFS_SUPER_INFO_SIZE, - offset_in_page(bytenr)); + bio_add_folio_nofail(bio, folio, BTRFS_SUPER_INFO_SIZE, offset); /* * We FUA only the first super block. The others we allow to From patchwork Sat Apr 20 02:49:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636936 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D93228479; Sat, 20 Apr 2024 02:50:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581453; cv=none; b=O/qRKuKDQc5XQ5wwsrqQcqlR4hEkxrKsr4MqipFNeMyGAzEx7HBDNXemQXOxXzOku++HeDaWchBOXqpkArtd9arxbNgEajgB53hxdNuK7IqJhENqSsXmqVHB2cO3m5kc35ZleMp4s6+UZUtefenB3cgPFBEU5J6fwb7R0JmFenc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581453; c=relaxed/simple; bh=SaJbg29cD4jUS8oam2mSfQ8wg7ZwQ9f4NykFWaMo2sI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=p0AGDuHJUekEGqtDq2jzrPfAHepUOY4p3snZ5KIU/eAikB4BOv6+EjeNagmLpz/kC7Obd9ABBrMp8Ds/yuU1+iwi2HQgFnwkRp+VJALgcQcefiOPoVt32rXVyWDZYTW1eWJYzATp/V/Ri7kxoOqE5uC3YPE02DcLzm85eA9VHRI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=hMfQKsyp; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="hMfQKsyp" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=v2Klto9l+15juQRC2IXlUpAVUx+8RwOiMD9dxj8rlPo=; b=hMfQKsypnw1fBKuFbYvazrTvrW HS8SVGLCiFtX4qgDoqT0/cmwY2guUO0vBz92UgPDqLQ3XbIAaHv3aIKCm2iKIlEHkXOKiY9Gne7m1 tcokWgbaXTamlR8vB/pv8EsHcmqSJe60DayL0Gn2/+clPjJMRJ2t5i6jHpnXIhfTA0JJQDW+ERwW9 lszJBpz3beAR/X+sIsrNqyQAcZrxaCZ4ck156Hb6XacVHgi5qO+y/z/d9rwHzIWfN3/CBWYoGb0eR m56UGox+BLxCLsHNvwI5xDlyAqNWJi/9TYbyUko7r8AielstLEeQj2ebFYNMoghA3/+XECtiyWb6a +oiPXESg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0oP-000000095e5-1cgp; Sat, 20 Apr 2024 02:50:45 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org Subject: [PATCH 03/30] btrfs: Use the folio iterator in btrfs_end_super_write() Date: Sat, 20 Apr 2024 03:49:58 +0100 Message-ID: <20240420025029.2166544-4-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Iterate over folios instead of bvecs. Switch the order of unlock and put to be the usual order; we know this folio can't be put until it's been waited for, but that's fragile. Remove the calls to ClearPageUptodate / SetPageUptodate -- if PAGE_SIZE is larger than BTRFS_SUPER_INFO_SIZE, we'd be marking the entire folio uptodate without having actually initialised all the bytes in the page. Cc: Chris Mason Cc: Josef Bacik Cc: David Sterba Cc: linux-btrfs@vger.kernel.org Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Johannes Thumshirn --- fs/btrfs/disk-io.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 8fa7c526093c..18c47bf3f383 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -3627,28 +3627,21 @@ ALLOW_ERROR_INJECTION(open_ctree, ERRNO); static void btrfs_end_super_write(struct bio *bio) { struct btrfs_device *device = bio->bi_private; - struct bio_vec *bvec; - struct bvec_iter_all iter_all; - struct page *page; - - bio_for_each_segment_all(bvec, bio, iter_all) { - page = bvec->bv_page; + struct folio_iter fi; + bio_for_each_folio_all(fi, bio) { if (bio->bi_status) { btrfs_warn_rl_in_rcu(device->fs_info, - "lost page write due to IO error on %s (%d)", + "lost sb write due to IO error on %s (%d)", btrfs_dev_name(device), blk_status_to_errno(bio->bi_status)); - ClearPageUptodate(page); - SetPageError(page); + folio_set_error(fi.folio); btrfs_dev_stat_inc_and_print(device, BTRFS_DEV_STAT_WRITE_ERRS); - } else { - SetPageUptodate(page); } - put_page(page); - unlock_page(page); + folio_unlock(fi.folio); + folio_put(fi.folio); } bio_put(bio); From patchwork Sat Apr 20 02:49:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636932 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 013BB79DE; Sat, 20 Apr 2024 02:50:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581452; cv=none; b=iEVA8vX+9YPtL62iL2SxzQxWyMzrSEmU4E3Q6SCuFGVeOaer7Ck0FdKbiSaW3OrnhqY20bu7mW9uojItO+VL8Ly52TpwPelFBtK1+kyl84/AYm/OBqEszaUdc0IK+mUdBm34g61qdIp6JJtg4FTM+qXDw+i4huI0gOTzFT4M3PQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581452; c=relaxed/simple; bh=6zw/DGvX4iHTZ43cuv+HPFmSiAYP11zruXeXS7YT3iQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CzUjBdMK2w4rfzSp0mN6QPn8IHubbVvN2BdLAyYXK8N+pIMTC1kpNyGIy9B4/gT7h9EKxL+0CW4pbkDHxqPN1X/ITb1UbJx+QpqOWwP+RJM9vTLFpMQpAa8wvOClj/azneI/a7iFUUKXKiDVVvmFqtAXkBPoIzTzpRilK2bmUbI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=Ak6RqJnJ; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Ak6RqJnJ" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=Vh4ZxQBjoUokzSVjhM/l0v5XocbZMAs1eA/cyY2hHz0=; b=Ak6RqJnJQQHWPqZpHoQ1DxDOUr Q6/R23PF1ihBxpXV3LuUv+9ZSHofjhpRVIrf+WnR2YgFTWEowcrSrSfF20LJpsbgPemebKnnEtdo2 jQAF+tIoRGDM20Yoz01wlKT18Uf8IuOvLi923WExLrCwGFkWZCauv5F0r/YoFq+LdG+cNAhMcsa76 tz2RyRyp0VDBH4fa0e4ddPlRAoA3Z2BbJjWhIQYjrmJ9fy/W2a3eaVDfwGF//Or/wmiI83j3jouEc FE+AxERqneyA3uSL3tcTDE7khfftIhQWl9BSe3cmP0ATqgWm+jStusaP3pKSoNN5+HO0i9fxF1tlq L6vHAwYw==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0oP-000000095e9-46IS; Sat, 20 Apr 2024 02:50:46 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org Subject: [PATCH 04/30] btrfs: Remove use of the folio error flag Date: Sat, 20 Apr 2024 03:49:59 +0100 Message-ID: <20240420025029.2166544-5-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Count the number of superblock writeback errors in the btrfs_device. That means we don't need the folio to stay around until it's waited for, and can avoid the extra call to folio_get/put. Also remove a mention of PageError in a comment. Cc: Chris Mason Cc: Josef Bacik Cc: David Sterba Cc: linux-btrfs@vger.kernel.org Signed-off-by: Matthew Wilcox (Oracle) --- fs/btrfs/disk-io.c | 44 ++++++++++++++++++-------------------------- fs/btrfs/extent_io.c | 2 +- fs/btrfs/volumes.h | 5 +++++ 3 files changed, 24 insertions(+), 27 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 18c47bf3f383..3fa073f969d8 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -3635,11 +3635,15 @@ static void btrfs_end_super_write(struct bio *bio) "lost sb write due to IO error on %s (%d)", btrfs_dev_name(device), blk_status_to_errno(bio->bi_status)); - folio_set_error(fi.folio); btrfs_dev_stat_inc_and_print(device, BTRFS_DEV_STAT_WRITE_ERRS); + /* Ensure failure if a primary sb fails */ + if (bio->bi_opf & REQ_FUA) + atomic_set(&device->sb_wb_errors, + BTRFS_DEV_PRIMARY_ERROR); + else + atomic_inc(&device->sb_wb_errors); } - folio_unlock(fi.folio); folio_put(fi.folio); } @@ -3743,10 +3747,11 @@ static int write_dev_supers(struct btrfs_device *device, struct address_space *mapping = device->bdev->bd_mapping; SHASH_DESC_ON_STACK(shash, fs_info->csum_shash); int i; - int errors = 0; int ret; u64 bytenr, bytenr_orig; + atomic_set(&device->sb_wb_errors, 0); + if (max_mirrors == 0) max_mirrors = BTRFS_SUPER_MIRROR_MAX; @@ -3766,7 +3771,7 @@ static int write_dev_supers(struct btrfs_device *device, btrfs_err(device->fs_info, "couldn't get super block location for mirror %d", i); - errors++; + atomic_inc(&device->sb_wb_errors); continue; } if (bytenr + BTRFS_SUPER_INFO_SIZE >= @@ -3785,13 +3790,10 @@ static int write_dev_supers(struct btrfs_device *device, btrfs_err(device->fs_info, "couldn't get super block page for bytenr %llu", bytenr); - errors++; + atomic_inc(&device->sb_wb_errors); continue; } - /* Bump the refcount for wait_dev_supers() */ - folio_get(folio); - offset = offset_in_folio(folio, bytenr); disk_super = folio_address(folio) + offset; memcpy(disk_super, sb, BTRFS_SUPER_INFO_SIZE); @@ -3819,9 +3821,9 @@ static int write_dev_supers(struct btrfs_device *device, submit_bio(bio); if (btrfs_advance_sb_log(device, i)) - errors++; + atomic_inc(&device->sb_wb_errors); } - return errors < i ? 0 : -1; + return atomic_read(&device->sb_wb_errors) < i ? 0 : -1; } /* @@ -3860,27 +3862,17 @@ static int wait_dev_supers(struct btrfs_device *device, int max_mirrors) folio = filemap_get_folio(device->bdev->bd_mapping, bytenr >> PAGE_SHIFT); - if (IS_ERR(folio)) { - errors++; - if (i == 0) - primary_failed = true; + /* If the folio has been removed, then we know it completed */ + if (IS_ERR(folio)) continue; - } - /* Folio is unlocked once the write completes */ + /* Folio is unlocked once the IO completes */ folio_wait_locked(folio); - if (folio_test_error(folio)) { - errors++; - if (i == 0) - primary_failed = true; - } - - /* Drop our reference */ - folio_put(folio); - - /* Drop the reference from the writing run */ folio_put(folio); } + errors += atomic_read(&device->sb_wb_errors); + if (errors >= BTRFS_DEV_PRIMARY_ERROR) + primary_failed = true; /* log error, force error return */ if (primary_failed) { btrfs_err(device->fs_info, "error writing primary super block to device %llu", diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 7b10f47d8f83..7a1bd23833e5 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -1602,7 +1602,7 @@ static void set_btree_ioerr(struct extent_buffer *eb) * can be no longer dirty nor marked anymore for writeback (if a * subsequent modification to the extent buffer didn't happen before the * transaction commit), which makes filemap_fdata[write|wait]_range not - * able to find the pages tagged with SetPageError at transaction + * able to find the pages which contain errors at transaction * commit time. So if this happens we must abort the transaction, * otherwise we commit a super block with btree roots that point to * btree nodes/leafs whose content on disk is invalid - either garbage diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h index cf555f5b47ce..cdab144410a8 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h @@ -92,6 +92,9 @@ enum btrfs_raid_types { #define BTRFS_DEV_STATE_FLUSH_SENT (4) #define BTRFS_DEV_STATE_NO_READA (5) +/* We'll never have this many superblocks */ +#define BTRFS_DEV_PRIMARY_ERROR (INT_MAX / 2) + struct btrfs_fs_devices; struct btrfs_device { @@ -142,6 +145,8 @@ struct btrfs_device { /* type and info about this device */ u64 type; + atomic_t sb_wb_errors; + /* minimal io size for this device */ u32 sector_size; From patchwork Sat Apr 20 02:50:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636931 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B7E379F6 for ; Sat, 20 Apr 2024 02:50:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581451; cv=none; b=NGHN2d+Abwc2L3xQcBiaZ4NSRvMEl2yxnLHXl+9qqksfySpCBNUMj/V5VJbS8GODstOpW5554C9T3xw44ws/5Wj6xX9RJ6xsWpdCdo6z/ZNz5KXhX3ofoYAV/SmwYtOhSax73QbbCfERPva+aEi7PvSO8biZ63ikNPxGrg07/S4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581451; c=relaxed/simple; bh=PRX6KlJUsaaPFg8OvVkWBoq4vffTbDR7hsUvhUjcDlc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tyfjmBi5syWqtdrdoynWj+EsUh6mmNTkzSXMTHPOijsWtieDBM5PajHM2avaTm/O5eRqNAm7m7zoKycNapdGsjaB2EzECTXrEjvK/9GhFbhCbmF+mQ5wPzrfg0m/eOWF56654Mzf6IkYORRnjaUd2hb+gog+9crzem451MHoyig= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=KvloMV0X; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="KvloMV0X" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=+AYemDyRNXF7Y77XIBHs0ndHktj5Du5D1auXiCRD6+c=; b=KvloMV0XxZj9W2tlfTOg9g7djT 5vIh0qK0pUypRKNRA+H6V74R6kQLTodkJkwf9v0qBiWQHzb+ymXDctOdtx81sDsQuLn79rgkponD7 VvcwM352CxaY8SMvkqA9QBzCSggxIqhNRU+z+3Wi9+aH5EAl6+GPvpyK3DMlbnH68p0da0dTfhvgW dNQZ2qu+ZgWeda5f5O9M7PqClrQQRmehdMq4OQuObr9eXC6NPIoWCfPniOMSRAe+JnmhDaG1dm805 UfOWmSMLsk1EoV082P9hcK7ZoINCGA3GlBGbD9TFftJsfLgZH0MVNt5w4iWgnBjnALmy2JLkSYaMh Ep7lL0Nw==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0oQ-000000095eH-3AlU; Sat, 20 Apr 2024 02:50:46 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Dave Kleikamp , jfs-discussion@lists.sourceforge.net Subject: [PATCH 05/30] jfs: Remove use of folio error flag Date: Sat, 20 Apr 2024 03:50:00 +0100 Message-ID: <20240420025029.2166544-6-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Store the blk_status per folio (if we can have multiple metapages per folio) instead of setting the folio error flag. This will allow us to reclaim a precious folio flag shortly. Cc: Dave Kleikamp Cc: jfs-discussion@lists.sourceforge.net Signed-off-by: Matthew Wilcox (Oracle) --- fs/jfs/jfs_metapage.c | 47 +++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c index 19854bd8dfea..df575a873ec6 100644 --- a/fs/jfs/jfs_metapage.c +++ b/fs/jfs/jfs_metapage.c @@ -76,6 +76,7 @@ static mempool_t *metapage_mempool; struct meta_anchor { int mp_count; atomic_t io_count; + blk_status_t status; struct metapage *mp[MPS_PER_PAGE]; }; @@ -138,12 +139,16 @@ static inline void inc_io(struct folio *folio) atomic_inc(&anchor->io_count); } -static inline void dec_io(struct folio *folio, void (*handler) (struct folio *)) +static inline void dec_io(struct folio *folio, blk_status_t status, + void (*handler)(struct folio *, blk_status_t)) { struct meta_anchor *anchor = folio->private; + if (anchor->status == BLK_STS_OK) + anchor->status = status; + if (atomic_dec_and_test(&anchor->io_count)) - handler(folio); + handler(folio, anchor->status); } #else @@ -168,7 +173,7 @@ static inline void remove_metapage(struct folio *folio, struct metapage *mp) } #define inc_io(folio) do {} while(0) -#define dec_io(folio, handler) handler(folio) +#define dec_io(folio, status, handler) handler(folio, status) #endif @@ -258,23 +263,20 @@ static sector_t metapage_get_blocks(struct inode *inode, sector_t lblock, return lblock; } -static void last_read_complete(struct folio *folio) +static void last_read_complete(struct folio *folio, blk_status_t status) { - if (!folio_test_error(folio)) - folio_mark_uptodate(folio); - folio_unlock(folio); + if (status) + printk(KERN_ERR "Read error %d at %#llx\n", status, + folio_pos(folio)); + + folio_end_read(folio, status == 0); } static void metapage_read_end_io(struct bio *bio) { struct folio *folio = bio->bi_private; - if (bio->bi_status) { - printk(KERN_ERR "metapage_read_end_io: I/O error\n"); - folio_set_error(folio); - } - - dec_io(folio, last_read_complete); + dec_io(folio, bio->bi_status, last_read_complete); bio_put(bio); } @@ -300,11 +302,17 @@ static void remove_from_logsync(struct metapage *mp) LOGSYNC_UNLOCK(log, flags); } -static void last_write_complete(struct folio *folio) +static void last_write_complete(struct folio *folio, blk_status_t status) { struct metapage *mp; unsigned int offset; + if (status) { + int err = blk_status_to_errno(status); + printk(KERN_ERR "metapage_write_end_io: I/O error\n"); + mapping_set_error(folio->mapping, err); + } + for (offset = 0; offset < PAGE_SIZE; offset += PSIZE) { mp = folio_to_mp(folio, offset); if (mp && test_bit(META_io, &mp->flag)) { @@ -326,12 +334,7 @@ static void metapage_write_end_io(struct bio *bio) BUG_ON(!folio->private); - if (bio->bi_status) { - int err = blk_status_to_errno(bio->bi_status); - printk(KERN_ERR "metapage_write_end_io: I/O error\n"); - mapping_set_error(folio->mapping, err); - } - dec_io(folio, last_write_complete); + dec_io(folio, bio->bi_status, last_write_complete); bio_put(bio); } @@ -454,10 +457,10 @@ static int metapage_write_folio(struct folio *folio, 4, bio, sizeof(*bio), 0); bio_put(bio); folio_unlock(folio); - dec_io(folio, last_write_complete); + dec_io(folio, BLK_STS_OK, last_write_complete); err_out: while (bad_blocks--) - dec_io(folio, last_write_complete); + dec_io(folio, BLK_STS_OK, last_write_complete); return -EIO; } From patchwork Sat Apr 20 02:50:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636938 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4AD8E524A; Sat, 20 Apr 2024 02:50:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581455; cv=none; b=SHQQjknjLpiIE4p6xdiJEhM6FUBUMPfvmE7ysERDuivN3TZyem6sa5Cpzu1uLbHtraneuxj3uuOe42Gm3aYDdOpgKQ2gArwYzsrv1hYT+RniXuE3XT1X+Ja7mpALdp0izXzMlnPTgTLcGWPkq3jJfuOBcBxNMlTgPtFFvfy61Bw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581455; c=relaxed/simple; bh=ViXNIW1SLdv0nde+ZVI4iGu52qH5oiMusV+Y9g+vLlI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JGF6aNw6LD/u8aBK+WpF4d9BGhBhPcYyQXAjp4hJj48iuijS04p7ACGa+U10QVn444H9vms3rN42s8J6UC1vVV+5Gene11Wwl2QBL7lqXgm/OdLIWk+DWtXO2G/47WONUEbRd3+JYmwhALs2xT5SahX31pVpMRb/oeLj777FKkM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=BnR6+cuO; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="BnR6+cuO" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=chzZuDfvyKueDkxp43gj4gyRB7S/U2vP2n7I3PARTas=; b=BnR6+cuOapGQsp32FKIMq8Mimc 2KW+31ziJ4ibIcoDLYHEjZvGYs/MhFlYzKnMpNAQ5p7Fxm8hLRhvvioeCFvJYiXtkTXBNmpsYWsvu qHJLjrzYF2yEczWaDAwfwHNXHn0nyc1TbNcM7sAOGR8/H+Ay0EQSWkeAfBw4+smJguBQ31F7tstaW Uv0bazg+RQ6iiuw1fTmVZkgdVOn6Q841hgPjx+LqYrIDv1+nlwKi60rpJPoUkllo/FTxxAA5bHcDu 71mr0uwWIwlkAiIC9NaxGBc8+PzZrpfXqBN6DU8NynAJiyhqp6v7iAT8lvYQ5xQcNVO364N6TUShN 7b11pzhA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0oR-000000095eP-2qd4; Sat, 20 Apr 2024 02:50:47 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Kent Overstreet , Brian Foster , linux-bcachefs@vger.kernel.org Subject: [PATCH 06/30] bcachefs: Remove calls to folio_set_error Date: Sat, 20 Apr 2024 03:50:01 +0100 Message-ID: <20240420025029.2166544-7-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Common code doesn't test the error flag, so we don't need to set it in bcachefs. We can use folio_end_read() to combine the setting (or not) of the uptodate flag and clearing the lock flag. Cc: Kent Overstreet Cc: Brian Foster Cc: linux-bcachefs@vger.kernel.org Signed-off-by: Matthew Wilcox (Oracle) --- fs/bcachefs/fs-io-buffered.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/fs/bcachefs/fs-io-buffered.c b/fs/bcachefs/fs-io-buffered.c index 39292e7ef342..4bff641b8be6 100644 --- a/fs/bcachefs/fs-io-buffered.c +++ b/fs/bcachefs/fs-io-buffered.c @@ -30,15 +30,8 @@ static void bch2_readpages_end_io(struct bio *bio) { struct folio_iter fi; - bio_for_each_folio_all(fi, bio) { - if (!bio->bi_status) { - folio_mark_uptodate(fi.folio); - } else { - folio_clear_uptodate(fi.folio); - folio_set_error(fi.folio); - } - folio_unlock(fi.folio); - } + bio_for_each_folio_all(fi, bio) + folio_end_read(fi.folio, bio->bi_status == BLK_STS_OK); bio_put(bio); } @@ -408,7 +401,6 @@ static void bch2_writepage_io_done(struct bch_write_op *op) bio_for_each_folio_all(fi, bio) { struct bch_folio *s; - folio_set_error(fi.folio); mapping_set_error(fi.folio->mapping, -EIO); s = __bch2_folio(fi.folio); From patchwork Sat Apr 20 02:50:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636934 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 976F0BE65 for ; Sat, 20 Apr 2024 02:50:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581452; cv=none; b=gFKruss86ycFgNlfPZg8c/kQXMPZaHSS/C0A4Mbk087OcI76oM0WDX9XRgmiEYQcgHEbEPdLzbGD1Jd+2FwfFQvNh3ui16TAfbv1tx81or7luoBKmebaHohwO8oOjwUtMYsU09lyiXcmnAk0i4Tfc28nyPGIHnbP4pFut9YdqXc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581452; c=relaxed/simple; bh=NrpArSDjTXz0rUIvyWB9REeBUpI01g6IboTJmNiDC6M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CPdkFl9tVmwwMARr5aAokXCKGfxfHjvQx7PyWSnRSSmUQVf3+MpyiDVjppZtJU6lx/xV2P7OxEsETXn86AkdfKaRAk+ymmP1s34dlIfCxbVeQuNEuDY0V+NlpfDzOU9gHRapSli8TRpfA6QnTnnjSRzUufMEAlMwl0MGGXiKjxE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=OAQ7QDzm; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="OAQ7QDzm" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=xDEyHT7YZIluP2Z1qAqXZa0cLa7iWu0LWV7S69T1mb8=; b=OAQ7QDzmbSM5LbarRwn4fZ4KC4 zGXfsEYR2nF86TxhZ23O+vbNsdDIANizDQPcQF6Yh+o1Rh82o3AiUVN1Fjo+VwmOTeuZ+uGabwcdC Tvji3aiDra8pjJyewFJD38qVL6xA6yvf3MgbL7SemHJH6JxEkeyvuQtnV8KXLJvDsyZxfJWO6mAsH nTvMw5Ol0zDeEv8n1E3SsoZN1We4REyHHw3akN7JPp9uX9c8ddMoECxmLjBYxbj9RjfU3ttqXw7nB +dIXAdyuMOHy2Gj6gYcoCRwwcGp5apNPPzBdqlf7+PDPbedZyb1VFONqO7eyeea33B19L9LiMMyip UaxCXteg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0oS-000000095eW-1cwe; Sat, 20 Apr 2024 02:50:48 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Luis de Bethencourt , Salah Triki Subject: [PATCH 07/30] befs: Convert befs_symlink_read_folio() to use folio_end_read() Date: Sat, 20 Apr 2024 03:50:02 +0100 Message-ID: <20240420025029.2166544-8-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This is slightly more efficient than separate calls to folio_mark_uptodate() and folio_unlock(), and it's easier to read. Get rid of the call to folio_set_error() as nobody will check this flag. Cc: Luis de Bethencourt Cc: Salah Triki Signed-off-by: Matthew Wilcox (Oracle) --- fs/befs/linuxvfs.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index d76f406d3b2e..f92f108840f5 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -475,6 +475,7 @@ static int befs_symlink_read_folio(struct file *unused, struct folio *folio) befs_data_stream *data = &befs_ino->i_data.ds; befs_off_t len = data->size; char *link = folio_address(folio); + int err = -EIO; if (len == 0 || len > PAGE_SIZE) { befs_error(sb, "Long symlink with illegal length"); @@ -487,13 +488,10 @@ static int befs_symlink_read_folio(struct file *unused, struct folio *folio) goto fail; } link[len - 1] = '\0'; - folio_mark_uptodate(folio); - folio_unlock(folio); - return 0; + err = 0; fail: - folio_set_error(folio); - folio_unlock(folio); - return -EIO; + folio_end_read(folio, err == 0); + return err; } /* From patchwork Sat Apr 20 02:50:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636941 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C087ADF6C for ; Sat, 20 Apr 2024 02:50:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581457; cv=none; b=pjJxmz+kefQJxSyIinmq6PN2PDRLHId8IQAoSRTc0LabGi/8VseuZWdomhrwvuyintazX+3co2ogz+7m6zX1q7mmZMEVGFInCLMTaadJgBPldVMVQHKqD0rivsa4rfwFe8NPOAMXa6nc2v/BsOrbRF/X9gRKJETnoFGNUbyGBnI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581457; c=relaxed/simple; bh=9Wl7Or5G3IkXqEPcsD85gLYq/lgOOE3G7+fWToxy6xA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sMYOYFPP5gk/wKYS63gEV2N+zwTsnKZsaGVnDaU8DwSPC4vkdmqC5LRjR5eMhQjTLCNbtyczYw9lkV3mdBtqOAjg4Z9XrM1yF7b6uUmbSkANZsl7vr/5eQIVugdl8sLmsio5QugOhPMGaljf8L8QHTYcB2/E0tBcrupVtATmyZs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=YKC4lDY3; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="YKC4lDY3" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=lfQiTKH6qz2CerAT9IefP0Uh9+x805gtJN1XTCu7aP0=; b=YKC4lDY3fCCGK1nxYq+3kOvjvA Yi9muG8VsEYA3lVXRBD5uCCfwSV8PwMfjsrdxMKOq345k5UsUn1F4KkTpCr6+zxuC7Ca5kc6uUpsT Xu8G/tYBxcjzfPJJL7jd4N3SGal5GDI5CvTCd35pst8DQYNeMc4lQKXeZ4NyD18j2brKw6ol8GKVx pofwl66XzQvJ8ugN+4oIjpmwWZ0PpPn3ioLQlAa/FPOJfbEqWTMMk1Op8Hu9efdD6IEPDWeQVmJD0 fXQIp6B4ZxUGr23MTtuwEYKlJXRq0sPmJcKlu5SPxFRoDnAKfARDcE9eQ3R8iLDKeLtFwuR0zlR51 cCaaRQDw==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0oT-000000095eY-01nX; Sat, 20 Apr 2024 02:50:49 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Jan Harkes , coda@cs.cmu.edu Subject: [PATCH 08/30] coda: Convert coda_symlink_filler() to use folio_end_read() Date: Sat, 20 Apr 2024 03:50:03 +0100 Message-ID: <20240420025029.2166544-9-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This is slightly more efficient than separate calls to folio_mark_uptodate() and folio_unlock(), and it's easier to read. Get rid of the call to folio_set_error() as nobody will check this flag. Cc: Jan Harkes Cc: coda@cs.cmu.edu Signed-off-by: Matthew Wilcox (Oracle) --- fs/coda/symlink.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/fs/coda/symlink.c b/fs/coda/symlink.c index ccdbec388091..40f84d014524 100644 --- a/fs/coda/symlink.c +++ b/fs/coda/symlink.c @@ -31,15 +31,7 @@ static int coda_symlink_filler(struct file *file, struct folio *folio) cii = ITOC(inode); error = venus_readlink(inode->i_sb, &cii->c_fid, p, &len); - if (error) - goto fail; - folio_mark_uptodate(folio); - folio_unlock(folio); - return 0; - -fail: - folio_set_error(folio); - folio_unlock(folio); + folio_end_read(folio, error == 0); return error; } From patchwork Sat Apr 20 02:50:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636935 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D19BAD28D; Sat, 20 Apr 2024 02:50:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581453; cv=none; b=YuDlGXwzA82cn8d3yEvWorPw86yZDbGizUN7ufPHDHazHv98ICevZ2CxXLfZrYp65sQyj8/P/pWUQDt4TcISfdziw/e6/DAxN5OIbKPG+Om6V8/Ip/xvRyszL/Iz5b7blteNqnDICvgrshHCoVD8zwCAkZ0UsGsAd/ds6VSo9YY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581453; c=relaxed/simple; bh=461oIRJVkOSJt+6eGbytBOWDsr7XKn7IVFk3W2GUS8o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KH0jAzVhUNt+LGw+BVvgAQ44oUg4l8dYz/abu/38v+8wqcWKCa2MjTd3ZWErHcw19hI4n9WBZkLpODxSikxRn55h10SxVqLrofNserO3jamYBFTiPFTurtSeAvpgjptk1lwc7QlDZ6Ep76hlChP/foAk6GjqEcjiTEM1mYHCetE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=ccfV/Pxn; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="ccfV/Pxn" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=71ZafleQD+R3DGGFGHBFk5j/wGDiTmNRlBu2wjMI1mw=; b=ccfV/Pxnm9UqJ4evTg3LvRIA+B PLEOjwWamnsBFf2AZHiBSf/TXvtZZqqSgz1CYud/Jfb24NekQMjVzm/8qCM1ttfVccfdGjL6VpCP+ 39stLm3mrEC9JO1vxMvtJBymymfr477C4JUNgPojMFVZIuNff6aYHpwBzMFn+5vaNkNtuwCvtcihc Ko8ushlskuGT2ubOTllxaMvH9pxOB4LbClo/DuHdDiZZvLoZotLjb5YWS14LZK4up1FXdkh1YJmRm K0R9OIIOfwWlDH5EnSSUHlZGblY272b5P8s9gt6os+fHAYh2DYeedb+8KPkI7X7j6gLEtJQx/YZJ7 p8T2IMWg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0oT-000000095em-24z3; Sat, 20 Apr 2024 02:50:49 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Jan Kara , linux-ext4@vger.kernel.org Subject: [PATCH 09/30] ext2: Remove call to folio_set_error() Date: Sat, 20 Apr 2024 03:50:04 +0100 Message-ID: <20240420025029.2166544-10-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Nobody checks this flag on ext2 folios, stop setting it. Cc: Jan Kara Cc: linux-ext4@vger.kernel.org Signed-off-by: Matthew Wilcox (Oracle) --- fs/ext2/dir.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c index 4fb155b5a958..087457061c6e 100644 --- a/fs/ext2/dir.c +++ b/fs/ext2/dir.c @@ -175,7 +175,6 @@ static bool ext2_check_folio(struct folio *folio, int quiet, char *kaddr) (unsigned long) le32_to_cpu(p->inode)); } fail: - folio_set_error(folio); return false; } From patchwork Sat Apr 20 02:50:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636937 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ECF9CDF6C; Sat, 20 Apr 2024 02:50:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581454; cv=none; b=oHCCX03eh1NYAwx2KPS1NFlsvzEk3g7VbxT5qrFRyJpxFPSfHo4waL249BHbSox5dpB5UgncEXMgW4Kw/TtqyRxfYnx38w6gdQy8jmEXWpknBYQsg+gijnBjke9NjQaHcFi1gBvaqG/6pZJ2wUm9hcRZPqJKPPQR4Od5ZeIaOCY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581454; c=relaxed/simple; bh=0pUhsRmxI57MJbaxxpksnWkU0obUAmCXJosmad6eEok=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=owcWlQ1sw9NL7cbUQrLk8XviA6JXBKQxfVNyt3+8c7j64/ZGtVKWryX6WMVtHJD1fdvdkoBcdyupfRs+hgdrj/okksMGv6TNmBZFODCzEqTT3ioSsJBPeC88Je0gPDhCxv4a3P5vC0EhIYW9spGr1eZ46vPbSuSTFOkHgUozUnc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=oswz8Xuq; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="oswz8Xuq" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=dNECBjnrSSu5e/nvTW6lm2Csp1lUOxKAeyT8FWOeI68=; b=oswz8Xuq7L0CKI1a3NqA3G3jRw VcrviRBG60j7Fk2f/5UKOMBIE8SK70zDo7Lnoo66jGDqMwttPRKz5cAaDAygba1D0tHEho3mGqyGt N/Aqc5xPlBK3LAkTL+skBwE+RYzFk7uBw91W4OOP3PcgQeveAs9o9Y9kN7i8/qunDdduWOC1P8lg6 vo13HtktVbS6UNojDReIhWkDBnWBXbPkP0V56hDajxZUtKOGGdsv+o89hw48bqo/GB3T365GITcPG v+GUdLPnbHhWIY2nZUBiMwxTqT6+T5aWVi6bsgVwV+Q65G4RyjTdHjGQVuG5YdW/4u7pcECE7H+Ar /r7HmNSA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0oT-000000095es-3oI4; Sat, 20 Apr 2024 02:50:50 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , "Theodore Ts'o" , Andreas Dilger , linux-ext4@vger.kernel.org Subject: [PATCH 10/30] ext4: Remove calls to to set/clear the folio error flag Date: Sat, 20 Apr 2024 03:50:05 +0100 Message-ID: <20240420025029.2166544-11-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Nobody checks this flag on ext4 folios, stop setting and clearing it. Cc: "Theodore Ts'o" Cc: Andreas Dilger Cc: linux-ext4@vger.kernel.org Signed-off-by: Matthew Wilcox (Oracle) --- fs/ext4/move_extent.c | 4 +--- fs/ext4/page-io.c | 3 --- fs/ext4/readpage.c | 1 - 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c index 7cd4afa4de1d..204f53b23622 100644 --- a/fs/ext4/move_extent.c +++ b/fs/ext4/move_extent.c @@ -199,10 +199,8 @@ mext_page_mkuptodate(struct folio *folio, unsigned from, unsigned to) continue; if (!buffer_mapped(bh)) { err = ext4_get_block(inode, block, bh, 0); - if (err) { - folio_set_error(folio); + if (err) return err; - } if (!buffer_mapped(bh)) { folio_zero_range(folio, block_start, blocksize); set_buffer_uptodate(bh); diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c index 312bc6813357..ad5543866d21 100644 --- a/fs/ext4/page-io.c +++ b/fs/ext4/page-io.c @@ -117,7 +117,6 @@ static void ext4_finish_bio(struct bio *bio) if (bio->bi_status) { int err = blk_status_to_errno(bio->bi_status); - folio_set_error(folio); mapping_set_error(folio->mapping, err); } bh = head = folio_buffers(folio); @@ -441,8 +440,6 @@ int ext4_bio_write_folio(struct ext4_io_submit *io, struct folio *folio, BUG_ON(!folio_test_locked(folio)); BUG_ON(folio_test_writeback(folio)); - folio_clear_error(folio); - /* * Comments copied from block_write_full_folio: * diff --git a/fs/ext4/readpage.c b/fs/ext4/readpage.c index 21e8f0aebb3c..8494492582ab 100644 --- a/fs/ext4/readpage.c +++ b/fs/ext4/readpage.c @@ -289,7 +289,6 @@ int ext4_mpage_readpages(struct inode *inode, if (ext4_map_blocks(NULL, inode, &map, 0) < 0) { set_error_page: - folio_set_error(folio); folio_zero_segment(folio, 0, folio_size(folio)); folio_unlock(folio); From patchwork Sat Apr 20 02:50:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636947 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 906F4175B1 for ; Sat, 20 Apr 2024 02:50:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581461; cv=none; b=uiGh8sMdJlN5Kb65IWUPoO8EHnjNgv2yaK2caEWk87QgRZzx11DQq09nmJgioDBMsipJjWlDOzQoy9KCfcBFD5JSlANmiMCnh4yh8RK5Q0Xn6uGWPmvInYIy0EfL3v2Ygc4FcuY0+QeiZowgAiy6ih4i4d9lv3EoUGQBi2dF8to= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581461; c=relaxed/simple; bh=TvqLSu2qo0lh/b1fZFV6UNHbkBv75iclu0kdDFZ9yG0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GGhK7A6Mu/VH1F8Z22ZCVkBhUNs25zf5Rn3jrLjkNasuxNdUwzFhUlIrWnVEWx483M5zg2B+yuSzTbOGEYeDjBYbXBrT2sEG504+OS6qwZxONj2eIMBAbJsomaJIQAg5qrcGNAJZLsucCvgB6VwedJYSwNwnw2q8AQHKl1lKth4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=S5+TgAjD; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="S5+TgAjD" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=FOaktHNmxMd+cZ/fUyKcI80t1QsvXs7Jj3EI/hp2RVs=; b=S5+TgAjD6hrJluFct7n5ncCee3 IAY5RChLf4XDLdw0Ip2ZpGIosRDF8zrKPgGAz7o87C+ox353HukxEGo8Oa3RYAjxg1bsyz8XnY1/M V6o05uFf/YvLk5suAvLSnBbConzUa1TS+xWZPWbLDZraIYez0hAvMImTcN9S39kAOrxgObNtNOhmX xFOv+TeEtTsEfQPP/SaqRJF4Hy19E3qTobzGipD3KTmDMdxosETWa4Lvy/OJzgtpqONb+PYYdfXZv VcwkHmWznwtIeqhEBJKAlphgyZxjCz5kVmjYrHRo4fNSlutVMw3imD7VVdzybWuOkha9WuCOivoAt z5wm97Pg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0oU-000000095ey-1okc; Sat, 20 Apr 2024 02:50:50 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Miklos Szeredi Subject: [PATCH 11/30] fuse: Convert fuse_readpages_end() to use folio_end_read() Date: Sat, 20 Apr 2024 03:50:06 +0100 Message-ID: <20240420025029.2166544-12-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Nobody checks the error flag on fuse folios, so stop setting it. Optimise the (optional) setting of the uptodate flag and clearing of the lock flag by using folio_end_read(). Cc: Miklos Szeredi Signed-off-by: Matthew Wilcox (Oracle) --- fs/fuse/file.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index b57ce4157640..f39456c65ed7 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -935,14 +935,10 @@ static void fuse_readpages_end(struct fuse_mount *fm, struct fuse_args *args, } for (i = 0; i < ap->num_pages; i++) { - struct page *page = ap->pages[i]; + struct folio *folio = page_folio(ap->pages[i]); - if (!err) - SetPageUptodate(page); - else - SetPageError(page); - unlock_page(page); - put_page(page); + folio_end_read(folio, !err); + folio_put(folio); } if (ia->ff) fuse_file_put(ia->ff, false); From patchwork Sat Apr 20 02:50:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636948 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3E3FA1773D for ; Sat, 20 Apr 2024 02:50:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581461; cv=none; b=cWBlje0kRuQpWe5jHpy5m8dbF/yui6WQRwa2D0+1me3dThxzUStpwGNXEKUGlnXIdW0/nlwaxqCxz0vIX1ssxdn7msOs2rD8U75N4dCSpj1H6+fN20tYtjOfNfXHLc4LQOlJXrNXminLrqsQXtZpdotc+MJZZO/vX2FcoHMY0ks= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581461; c=relaxed/simple; bh=BKV41FpzXQN+Fwf0Q86zXKTmVIYTkt83bZpcdl3/PRg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VemZYNS9aICnJHXBEf2AynxVuRp3l2LGLDHkkicdwSIZ/Ad26WUi+SB4WezCZ2ARBcYWr8oFlFfWIkEvEw/yfaWFii0gJ4kZ8TFVWPs0dre8dTMzGvql2dveHFVXXWa4UFQoVEcjf1xIHe0kC+/mrQBOA2Ex3tFs8XRvB0WUuIQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=ubi+VSlC; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="ubi+VSlC" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=9DNYu25PsP7kPSgGts/yb+luWRPbPj48AdRNc25boMg=; b=ubi+VSlCphTsd5AtD9cNNkb+HS nB/FMrouSxmA1uW+1Vxn+g98ve7pogJOK8MnjiaX3HIupI/wSrLZ3Sk0vyNgLubyrkD9i5YRmAmeX NsaMUr0g4f4Qp3IOBnTR1yCAi1HQ16jImzYPH91cMfTfFN2Z3rvEgIxhmYf6Flk95MtWplsxJaB/J ZKW/niTOR7NdHbEKV1qUkEtdncbL91pWCOZPe1fhsLW/K4r3wt5dsHyyRpM0yHuFsCUkk0LnhEXW9 699fPezQifdLcWOPNiyQ87VmwvgFRoL4cwBVcu6yVn533CSmzwg7CQdJG4o/3xBiCynO8D4/Xeibt SPmp2suA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0oU-000000095f0-2u7G; Sat, 20 Apr 2024 02:50:50 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Richard Weinberger , Anton Ivanov , Johannes Berg , linux-um@lists.infradead.org Subject: [PATCH 12/30] hostfs: Convert hostfs_read_folio() to use a folio Date: Sat, 20 Apr 2024 03:50:07 +0100 Message-ID: <20240420025029.2166544-13-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Remove the use of page APIs, including setting/clearing the error flag which is never checked on hostfs folios. This does not include support for large folios as kmap_local_folio() maps only one page at a time. Cc: Richard Weinberger Cc: Anton Ivanov Cc: Johannes Berg Cc: linux-um@lists.infradead.org Signed-off-by: Matthew Wilcox (Oracle) --- fs/hostfs/hostfs_kern.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index a73d27c4dd58..e7c72f2634f6 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c @@ -432,31 +432,20 @@ static int hostfs_writepage(struct page *page, struct writeback_control *wbc) static int hostfs_read_folio(struct file *file, struct folio *folio) { - struct page *page = &folio->page; char *buffer; - loff_t start = page_offset(page); + loff_t start = folio_pos(folio); int bytes_read, ret = 0; - buffer = kmap_local_page(page); + buffer = kmap_local_folio(folio, 0); bytes_read = read_file(FILE_HOSTFS_I(file)->fd, &start, buffer, PAGE_SIZE); - if (bytes_read < 0) { - ClearPageUptodate(page); - SetPageError(page); + if (bytes_read < 0) ret = bytes_read; - goto out; - } - - memset(buffer + bytes_read, 0, PAGE_SIZE - bytes_read); - - ClearPageError(page); - SetPageUptodate(page); - - out: - flush_dcache_page(page); + else + buffer = folio_zero_tail(folio, bytes_read, buffer); kunmap_local(buffer); - unlock_page(page); + folio_end_read(folio, ret == 0); return ret; } From patchwork Sat Apr 20 02:50:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636939 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E63379DE for ; Sat, 20 Apr 2024 02:50:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581455; cv=none; b=PyESao1XKaGmdvhtjJOJT+YGeyURO2gVQ8oyNc/a0PUqmt3tpgOMhT88zAHMqOiauEwcaigUbtgtwqwnipXGm6Usekx0AGqoNu89x2F5btqlHIduO3Yt6x1hN3RYN48SnhPqtMiWF0nq9Op5P4BvIDvVu1U6sqkn83EuUQZ2WhI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581455; c=relaxed/simple; bh=D0mLITYc67VFeEYU+H17Ni9bXDYOpEy3i7fXOO7W3Zs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UOMZtxvIMcsGkLPNav8qjKy+pwK09kdd++jUI0gFOmYcn/IwJh/RE0+Ue9jwoiYpQo46n25E0PMJW2FAkQwz5b8oCzXLQ32HltV17/FWUqskr/vo5W8lqNRkZQfG2pnUYjY3bG+GYl8A4JCpPbcC+IbNRLuWMIbv149TjJIofbs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=XX2gdXxv; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="XX2gdXxv" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=JCNUChKJkI8QTCzUepEtX3M4aIY9D4jEdCq5vjHw//M=; b=XX2gdXxv949Dj8HbAeWwj1gmw6 LXwnU+FGo09l41O+udHjeBORw+yYshrImgR29EgZDyzdhpGEku5FwXgnAJyOoIdZDtPew0R0f7CKH Spa2Yfaxek2DSshhMXFmzmKlao+AWDQBz7QNDHO1pJxshDdiZsliGigad+BQAzsEKw6e/t9SK7wH1 X+323blFh/MY6dEJt9CB6SykG6FsyXEaw+xx20RRXeRQnLWrrFgXbeZXLHAtl415/I3aT9RenBevc 8EEeyNdgrunZybSFszuS95uwBQSqD3GPIwm87OY80V379q9iiJoh0diaQe9AIuAwmS5qMsK/sATqo oW76Tgkg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0oV-000000095fE-1wU7; Sat, 20 Apr 2024 02:50:51 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Jan Kara Subject: [PATCH 13/30] isofs: Remove calls to set/clear the error flag Date: Sat, 20 Apr 2024 03:50:08 +0100 Message-ID: <20240420025029.2166544-14-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Nobody checks the error flag on isofs folios, so stop setting and clearing it. Cc: Jan Kara Signed-off-by: Matthew Wilcox (Oracle) Acked-by: Jan Kara --- fs/isofs/compress.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/fs/isofs/compress.c b/fs/isofs/compress.c index c4da3f634b92..34d5baa5d88a 100644 --- a/fs/isofs/compress.c +++ b/fs/isofs/compress.c @@ -346,8 +346,6 @@ static int zisofs_read_folio(struct file *file, struct folio *folio) for (i = 0; i < pcount; i++, index++) { if (i != full_page) pages[i] = grab_cache_page_nowait(mapping, index); - if (pages[i]) - ClearPageError(pages[i]); } err = zisofs_fill_pages(inode, full_page, pcount, pages); @@ -356,8 +354,6 @@ static int zisofs_read_folio(struct file *file, struct folio *folio) for (i = 0; i < pcount; i++) { if (pages[i]) { flush_dcache_page(pages[i]); - if (i == full_page && err) - SetPageError(pages[i]); unlock_page(pages[i]); if (i != full_page) put_page(pages[i]); From patchwork Sat Apr 20 02:50:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636940 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E992E13AEE for ; Sat, 20 Apr 2024 02:50:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581456; cv=none; b=XsxlJMXguhf1JRC36qYabjxs7kQClgml0Rn+jyira47j6O429l2OqHnaeBrhgjW8pK02OiCVQI6nf+U0blPCnJOqWr4EJkhDVZ5YybO5ag+jVXas/bzOaFPeeF0gcWfUOQxZu1KR/A46dQ5duNXriCo+TQ89/fMTt01dXd+yew8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581456; c=relaxed/simple; bh=dhMsOeZOEa/T0OHb4fPd3ZQCyJ7E97FVD7eKfaEcI4I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jRav+XPAGpAqNzqn8Oh8y7pFhSLv1TcdXhqY8QNX238ObhBy4NDtwH2CjybPDmqZlmLUIQfINyu9tUf9gax4z2mAhcPD6gJxqvji7AswoBfBe2dBDCm/5X0WyEsNkJqNclF4vGdfDliLMv7b08s03iNV75Si4R9FQUbXgSOn00w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=OKYm/Al+; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="OKYm/Al+" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=FtvvbXv86623ovyWG3cSTC9dm4lYYmfgrBjy1npS59Q=; b=OKYm/Al+FwhYahzTOGgwhqD5Nc I7/4fwWzcvjgc4gR8MjmGgTN7Em91EXe+XXle6Wb7xYQQ8PakkUQkaczbbVMZJdEtv2kEyp3w0liZ m9AuySHX1XYgAmWu9iqTTjKKcNtzqSiakDEsBBAgbo8oL5D/2djPp2TP0KryuY7xBMfeRC4KW2/M0 rG6igylk3pdL4du0dET5/zTKNrCw3Pwfr28VVpc9xasaxVBDPBmUTwvp9TJL+5hK/2qrtaR2ThtgO 7Wsy8kX2FIiX8ZeVdm11TkkvcCbKRnRbl72ASEnKJYc1nrVFWq5UlOQgvPwAryKWU0er5yLmC0Wrb RYxpXWWA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0oW-000000095fJ-2VQl; Sat, 20 Apr 2024 02:50:52 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , David Woodhouse , Richard Weinberger , linux-mtd@lists.infradead.org Subject: [PATCH 14/30] jffs2: Remove calls to set/clear the folio error flag Date: Sat, 20 Apr 2024 03:50:09 +0100 Message-ID: <20240420025029.2166544-15-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Nobody checks the error flag on jffs2 folios, so stop setting and clearing it. We can also remove the call to clear the uptodate flag; it will already be clear. Convert one of these into a call to mapping_set_error() which will actually be checked by other parts of the kernel. Cc: David Woodhouse Cc: Richard Weinberger Cc: linux-mtd@lists.infradead.org Signed-off-by: Matthew Wilcox (Oracle) Tested-by: Reviewed-by: Zhihao Cheng Acked-by: Richard Weinberger --- fs/jffs2/file.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c index 62ea76da7fdf..e12cb145147e 100644 --- a/fs/jffs2/file.c +++ b/fs/jffs2/file.c @@ -95,13 +95,8 @@ static int jffs2_do_readpage_nolock (struct inode *inode, struct page *pg) ret = jffs2_read_inode_range(c, f, pg_buf, pg->index << PAGE_SHIFT, PAGE_SIZE); - if (ret) { - ClearPageUptodate(pg); - SetPageError(pg); - } else { + if (!ret) SetPageUptodate(pg); - ClearPageError(pg); - } flush_dcache_page(pg); kunmap(pg); @@ -304,10 +299,8 @@ static int jffs2_write_end(struct file *filp, struct address_space *mapping, kunmap(pg); - if (ret) { - /* There was an error writing. */ - SetPageError(pg); - } + if (ret) + mapping_set_error(mapping, ret); /* Adjust writtenlen for the padding we did, so we don't confuse our caller */ writtenlen -= min(writtenlen, (start - aligned_start)); @@ -330,7 +323,6 @@ static int jffs2_write_end(struct file *filp, struct address_space *mapping, it gets reread */ jffs2_dbg(1, "%s(): Not all bytes written. Marking page !uptodate\n", __func__); - SetPageError(pg); ClearPageUptodate(pg); } From patchwork Sat Apr 20 02:50:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636943 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2F30E14A8D; Sat, 20 Apr 2024 02:50:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581457; cv=none; b=S6arKXVoANlrm7W7sQWZ17ylQK8oHOzH4cOdGf+GBtZRCdam2HNjD2b4v8M0xNiMWwZEAS2f5Zejd0lx5pY2l/Qz0eP4LQh39aGsdNql3z5bIKl8vp7+od5XPVPSCSQIhkAlZ7QxCxedzwL8mUU8VgqGnnWuIVSQtpXX932l/Ms= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581457; c=relaxed/simple; bh=GTTE/6QERROoY8vZDm/RpX/2qBuGiPz4JEzyCyMc3t4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DI9WaOZy6xHV6jyxMwxl4jvh0qi+8RwY6PxmirQoPam8Gn+5vcVQpXIbss99fIPsr/41R86Mpgyy0C+Kpx8SO91tae0HDJ6ca90Pj8vPWk2PiouLAQSxHjT0VgWsWUQ4tXWjcYWJl9Etc4GX8OhnGZ4hYuGQnFQoOWvMcYyKXaY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=dtLWcxJ4; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="dtLWcxJ4" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=c6SDuXJXlko5thNqbkIQf6N/gYuuZjZ0Ic3NpLHdQ5k=; b=dtLWcxJ4OWxvYGWQHmIs4GDQVZ To1sbmpOROnX7Eyc6Whm3uQ/jCnrBWWHEIzTs6kEYx1roTMDmUUZquDcnX+H5FIXNo/eWYDmokJvH R9+Ka9v4ZG+5umpMWVJ0fShP/BRjlV21bGHzPY37Ivh53eX/H3aFWIOWh4HExnDwme9dxx+p2pcoA gJbsBpc4kyMHi1ixPFJ7Zqbm2qlKcb9GZnjjqi40zmAj5I/blcMaPqk2doeDChieY44XZ2qPxlBb3 fnHMnDd7XsE6PdIXSpwH6iycvLRCNvpYtXpXoU/FLjnnBL/w/Ov3brcz8CkvHjRc3z9YZ11FFEf+V +XHQpxag==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0oX-000000095fT-1Khq; Sat, 20 Apr 2024 02:50:53 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Trond Myklebust , Anna Schumaker , linux-nfs@vger.kernel.org Subject: [PATCH 15/30] nfs: Remove calls to folio_set_error Date: Sat, 20 Apr 2024 03:50:10 +0100 Message-ID: <20240420025029.2166544-16-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Common code doesn't test the error flag, so we don't need to set it in nfs. We can use folio_end_read() to combine the setting (or not) of the uptodate flag and clearing the lock flag. Cc: Trond Myklebust Cc: Anna Schumaker Cc: linux-nfs@vger.kernel.org Signed-off-by: Matthew Wilcox (Oracle) --- fs/nfs/read.c | 2 -- fs/nfs/symlink.c | 12 ++---------- fs/nfs/write.c | 1 - 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/fs/nfs/read.c b/fs/nfs/read.c index a142287d86f6..cca80b5f54e0 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c @@ -122,8 +122,6 @@ static void nfs_readpage_release(struct nfs_page *req, int error) { struct folio *folio = nfs_page_to_folio(req); - if (nfs_error_is_fatal_on_server(error) && error != -ETIMEDOUT) - folio_set_error(folio); if (nfs_page_group_sync_on_bit(req, PG_UNLOCKPAGE)) if (nfs_netfs_folio_unlock(folio)) folio_unlock(folio); diff --git a/fs/nfs/symlink.c b/fs/nfs/symlink.c index 0e27a2e4e68b..1c62a5a9f51d 100644 --- a/fs/nfs/symlink.c +++ b/fs/nfs/symlink.c @@ -32,16 +32,8 @@ static int nfs_symlink_filler(struct file *file, struct folio *folio) int error; error = NFS_PROTO(inode)->readlink(inode, &folio->page, 0, PAGE_SIZE); - if (error < 0) - goto error; - folio_mark_uptodate(folio); - folio_unlock(folio); - return 0; - -error: - folio_set_error(folio); - folio_unlock(folio); - return -EIO; + folio_end_read(folio, error == 0); + return error; } static const char *nfs_get_link(struct dentry *dentry, diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 2329cbb0e446..a91463ab87a0 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -311,7 +311,6 @@ static void nfs_mapping_set_error(struct folio *folio, int error) { struct address_space *mapping = folio_file_mapping(folio); - folio_set_error(folio); filemap_set_wb_err(mapping, error); if (mapping->host) errseq_set(&mapping->host->i_sb->s_wb_err, From patchwork Sat Apr 20 02:50:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636942 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 415EF749F; Sat, 20 Apr 2024 02:50:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581457; cv=none; b=pDLfdKKSNLiwCNofkBDLEIg3rMromkaR3AKybYMCGenfJcmcAgG+Rmry7oNeWXWmPUhYD2MvkZRoc+8BbUAH1W2FT4J3LoYkze494PRyrG04LmJp7E5DrVBJq9VQk6JZaU+DRDz0RLgP0sDZyUYF8aeVaunBKNbAC2ldqJA+lt0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581457; c=relaxed/simple; bh=HVnd1Mb1/NtwBa6Eu186EYKmXaLq3nEiepFrZcGeTKQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jRHp1zUkNeAtIDiXYVx1ICWC660c7nFdhYhNEaPNq1wyWsefheSt4jLrj+op8mLLCnobF9tZTfU4oJnh006dRRyiA0tAJSO2oD82apawwUww/ox9geeyUO+TtgfWyuConB7F8OyxvysSycpVPuyT7NBt4sI+Jw4dxvDBXrDVYzw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=LGSiBxAf; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="LGSiBxAf" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=pz9w8m7kq9s1LgGwb6slhtsGeQaR9Xa1bpf2LLmcF2Y=; b=LGSiBxAf99cBeq/5kf7Xr3Yctw aMigaedfRr+YowO/XpaLlasyDEeXgnd9tOAByYq5kc8jLEGInTpykYfR6uRNonBcL3wo9auxywHV5 +TFYHCkcHMDbwJWUiuopBgZrwZ0QKgqD0fPuoLJN6+uLFP4SeuYIeA0KzhAJQU8fm7iDrKvf6PhPB b048TR3vVxpb6Tx9mj4kq2WHUxtvw5XLKYSSIp+5W+Zzf936HlzhuTjgGL2Vv6E/ZUWp3yduoptOs iDykDs6XMTweLCaN6ypNG5BVwxNghM0y+sr2L9/sqV6zi0468hNVTNg+xUmQZjDLEb/BCHc9S1lS6 3i3YouEg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0oX-000000095fb-3quP; Sat, 20 Apr 2024 02:50:54 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Ryusuke Konishi , linux-nilfs@vger.kernel.org Subject: [PATCH 16/30] nilfs2: Remove calls to folio_set_error() and folio_clear_error() Date: Sat, 20 Apr 2024 03:50:11 +0100 Message-ID: <20240420025029.2166544-17-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Nobody checks this flag on nilfs2 folios, stop setting and clearing it. That lets us simplify nilfs_end_folio_io() slightly. Cc: Ryusuke Konishi Cc: linux-nilfs@vger.kernel.org Signed-off-by: Matthew Wilcox (Oracle) Acked-by: Ryusuke Konishi --- fs/nilfs2/dir.c | 1 - fs/nilfs2/segment.c | 8 +------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c index aee40db7a036..a002a44ff161 100644 --- a/fs/nilfs2/dir.c +++ b/fs/nilfs2/dir.c @@ -174,7 +174,6 @@ static bool nilfs_check_folio(struct folio *folio, char *kaddr) dir->i_ino, (folio->index << PAGE_SHIFT) + offs, (unsigned long)le64_to_cpu(p->inode)); fail: - folio_set_error(folio); return false; } diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index aa5290cb7467..8654ab8ad534 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c @@ -1725,14 +1725,8 @@ static void nilfs_end_folio_io(struct folio *folio, int err) return; } - if (!err) { - if (!nilfs_folio_buffers_clean(folio)) - filemap_dirty_folio(folio->mapping, folio); - folio_clear_error(folio); - } else { + if (err || !nilfs_folio_buffers_clean(folio)) filemap_dirty_folio(folio->mapping, folio); - folio_set_error(folio); - } folio_end_writeback(folio); } From patchwork Sat Apr 20 02:50:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636944 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 64CA979DE; Sat, 20 Apr 2024 02:50:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581458; cv=none; b=nOM8umJWEzrN4h04B6BijLPKo1k3Q79tb6Me/SGMYeacq+daSz5qoLgpTk+p75n1frrmbZNYmwe57AkjWwsUKJgDc2neAFIUPkLX1aDLYRvQmvoqw2cCuaKrWiC9ayi7f77UUmVOv6JiXw1wwcWsKgXuPEtzQ4/PN0/RMQTCitQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581458; c=relaxed/simple; bh=JBMHCx32+MTaoX7pOxHoZ5qOitImkwXWOh6ZhtrER3Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JL557nS3YW0PcB7gTq0BlbMwNffb2aayHt2c0Ds4GHnQUe5t0r3QgyIM4TrqUACxByVAfjCxh/Rlds+NNahF5oujRtSi+Ax4utuhJsIcafpsHCg6y19wD1IwIF7eJOkiSkehFmsXmeuOYq8s4n9EFwi1vwSOcKf67oD3s9vcmXI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=DZhBD66V; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="DZhBD66V" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=eKSk8yOHrxF1A9Pm7zaTg06pb1+chA0GVOIhlKSs7/U=; b=DZhBD66V6uyJoQYNETjLIY/kK4 mKFWQksvSsiGu/W/Xn8nwRV9zPVlcfgUte6XCZ1Y52oS1eFQEVP1hCTbRqSxAREZGXjxoWnV2uiXU h46uL9FSwGfEie2ljwWuUCPz7aGn3oxt4OdWqUV6RgejwsQRRGJMRrZP6A7uT8LgvBC0J0ETq37H6 64SziAE10YRclVd3+Xeq7updwW1StfBcCsMw8mNU/ai2ox1Yv2JGkC7on4b/eYx1rVCDe4ZcGZkkW ZKx2NLSNQbrJgqYtKBCKKn57ZY9TXllQRjs5OJ/SiRzVFqvLBYXw6AxWAzBeXFREwfDXfCz5FHgh8 nATKLSMw==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0oY-000000095fh-2Dz8; Sat, 20 Apr 2024 02:50:54 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Konstantin Komarov , ntfs3@lists.linux.dev Subject: [PATCH 17/30] ntfs3: Remove calls to set/clear the error flag Date: Sat, 20 Apr 2024 03:50:12 +0100 Message-ID: <20240420025029.2166544-18-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Nobody checks the error flag on ntfs3 folios, so stop setting and clearing it. Cc: Konstantin Komarov Cc: ntfs3@lists.linux.dev Signed-off-by: Matthew Wilcox (Oracle) --- fs/ntfs3/frecord.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c index 7f27382e0ce2..e9836170e2be 100644 --- a/fs/ntfs3/frecord.c +++ b/fs/ntfs3/frecord.c @@ -2143,9 +2143,6 @@ int ni_readpage_cmpr(struct ntfs_inode *ni, struct page *page) err = ni_read_frame(ni, frame_vbo, pages, pages_per_frame); out1: - if (err) - SetPageError(page); - for (i = 0; i < pages_per_frame; i++) { pg = pages[i]; if (i == idx || !pg) @@ -2718,7 +2715,6 @@ int ni_read_frame(struct ntfs_inode *ni, u64 frame_vbo, struct page **pages, for (i = 0; i < pages_per_frame; i++) { pg = pages[i]; kunmap(pg); - ClearPageError(pg); SetPageUptodate(pg); } From patchwork Sat Apr 20 02:50:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636945 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DAF72168DD for ; Sat, 20 Apr 2024 02:50:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581459; cv=none; b=F6Mqdm3BDGxXHYHT535aZ+WrocoF4gxbybBmQCZtlz2+mv6WAGzJAfwYz/TG64giWXBqe32Nhmak35y/Mn4JRnfHzSn1r4LXOlAakIc5hMqu2o2OTNwh4trQHZKG7AOzfulRDTfgTH44BEF7mvFsyhNNCI0LGllw51SCXTswqFE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581459; c=relaxed/simple; bh=KaPNOVuUVuEjTVmcdyO8J4f57l7zVa1j6/lsJSmKYk0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pOgA9RTnthTFpPVqjYX3ZsEEJbDHsYQfweSw3o0A/9EHd1uwiG6MKnlOKDNdLdlNlOp9BoB2fNkcB0VVVT+hXkPHGgqYYgD3bbCY4qEtTh9znqBGTtmPKr9EJGS0+QcZJMNjCHZU54R+DbtpAXblVRrTpRLOZlMnmzM6zlIZmhU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=ruRXVF99; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="ruRXVF99" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=MJMENjdS4BJ0YzSSow5tG6Tg5qbkadhyjSdDc4cHqzI=; b=ruRXVF99zXFKvopDQnSF+8Bd9l iaWjA2w6KOon8kdBwDUeBM7P54+9T441HzJjm966NQ780OrVhREjfdyujh9ABmi7/L8Gk1KrWYUad hy/gsb5FnuaQ3KPDoRjKC1wwq99hk/VJXXHVYOZRMMTLKU7pqScZ8cO8kb0XwPV8e+c/FjKRC9zPc rCmyUssApXo1Kq8oYWL4VwQ6s8TNhS/gObU+6MgqWU8pfuDMmcTFZO8W8vmKNHHMm/aPA3ye3Ah+K /GyCP1/rWDExRK6Cj9he4RAp06QycdFEv4DHEmo+SIIvTdt3bn9aC4cVY7FI2fXrq/MiZ+4nTK4HZ 13vFSU8g==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0oZ-000000095fr-0MOh; Sat, 20 Apr 2024 02:50:55 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Mike Marshall , Martin Brandenburg , devel@lists.orangefs.org Subject: [PATCH 18/30] orangefs: Remove calls to set/clear the error flag Date: Sat, 20 Apr 2024 03:50:13 +0100 Message-ID: <20240420025029.2166544-19-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Nobody checks the error flag on orangefs folios, so stop setting and clearing it. We can also use folio_end_read() to simplify orangefs_read_folio(). Cc: Mike Marshall Cc: Martin Brandenburg Cc: devel@lists.orangefs.org Signed-off-by: Matthew Wilcox (Oracle) --- fs/orangefs/inode.c | 13 +++---------- fs/orangefs/orangefs-bufmap.c | 4 +--- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index 085912268442..fdb9b65db1de 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c @@ -56,7 +56,6 @@ static int orangefs_writepage_locked(struct page *page, ret = wait_for_direct_io(ORANGEFS_IO_WRITE, inode, &off, &iter, wlen, len, wr, NULL, NULL); if (ret < 0) { - SetPageError(page); mapping_set_error(page->mapping, ret); } else { ret = 0; @@ -119,7 +118,6 @@ static int orangefs_writepages_work(struct orangefs_writepages *ow, 0, &wr, NULL, NULL); if (ret < 0) { for (i = 0; i < ow->npages; i++) { - SetPageError(ow->pages[i]); mapping_set_error(ow->pages[i]->mapping, ret); if (PagePrivate(ow->pages[i])) { wrp = (struct orangefs_write_range *) @@ -303,15 +301,10 @@ static int orangefs_read_folio(struct file *file, struct folio *folio) iov_iter_zero(~0U, &iter); /* takes care of potential aliasing */ flush_dcache_folio(folio); - if (ret < 0) { - folio_set_error(folio); - } else { - folio_mark_uptodate(folio); + if (ret > 0) ret = 0; - } - /* unlock the folio after the ->read_folio() routine completes */ - folio_unlock(folio); - return ret; + folio_end_read(folio, ret == 0); + return ret; } static int orangefs_write_begin(struct file *file, diff --git a/fs/orangefs/orangefs-bufmap.c b/fs/orangefs/orangefs-bufmap.c index b501dc07f922..edcca4beb765 100644 --- a/fs/orangefs/orangefs-bufmap.c +++ b/fs/orangefs/orangefs-bufmap.c @@ -274,10 +274,8 @@ orangefs_bufmap_map(struct orangefs_bufmap *bufmap, gossip_err("orangefs error: asked for %d pages, only got %d.\n", bufmap->page_count, ret); - for (i = 0; i < ret; i++) { - SetPageError(bufmap->page_array[i]); + for (i = 0; i < ret; i++) unpin_user_page(bufmap->page_array[i]); - } return -ENOMEM; } From patchwork Sat Apr 20 02:50:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636946 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 64B431758C; Sat, 20 Apr 2024 02:50:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581460; cv=none; b=qI04bhINv81VQYZ1n+mq5W0O0mq+hy2/2rW35G2eOnMg3gMEJ4DoAWgH9vYIfL1wYMExK0LMSHeOlQgYio+YalFkFilCCnM+ITeMT6ychb/llTpWSthXJ1mJrBG/s2SeXy83oWZrJlur4yB0Odpy0YB9il0FP95mIS/NHDgWmLs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581460; c=relaxed/simple; bh=MNGQdCHzW25/+wHhXwXH/NMqYp82RBGV7NnH0nnxDOs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=p3ktFgMiQKwAb5RL9yG+kMsCqVbK+YFfOJr3s1EJ30YwHULbvBT4g/U3QgexoMJz9Ibv2QkW8vxfgLKRMWDtBhVAB194ccx6pBTc45pSzYp2KjNX/0Kpw7XMF4syKEle+LNHIvsP30EIHbLQyUIi/YNFpCwpRurpCbr9QLqr0oQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=EtAa4y1y; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="EtAa4y1y" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=sKwEaDMykkWblPGLhfvrNLPmAWo/K3PNSs0OffOfMK8=; b=EtAa4y1yR6TJYpH8imzwFAjDLY MJeab18QUoywR2LAOQ0hU5sraZ21/85GG3H0cyGiNFNzXgIhUtXeKheylmMWa0SZ3NuioxS0/ICn/ kQfxrhBCSZ481qcZ00WQtW4JGTXCqz3qp+tmEi7DNfiQiS13lA/hIYlK7mJDOPI45lQlZn7g1d4qW OklBbpTCXBqGYqCNxtDWguw6usp6Ls18o3hkkexexZXxb0Oui9/iOZJXPZJ0ZBoKw/W86oylFaOQ/ PoyJNmDrwuQ0JHAwkciyNtzi+s6cnFYSNzt0iJyAW6I8QAbUuIQkDxRqWxZEOZ1CSQp8Yqtf13rMQ ek51IygA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0oZ-000000095fy-3vKs; Sat, 20 Apr 2024 02:50:56 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , reiserfs-devel@vger.kernel.org Subject: [PATCH 19/30] reiserfs: Remove call to folio_set_error() Date: Sat, 20 Apr 2024 03:50:14 +0100 Message-ID: <20240420025029.2166544-20-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The error flag is never tested for reiserfs folios, so stop setting it. Cc: reiserfs-devel@vger.kernel.org Signed-off-by: Matthew Wilcox (Oracle) --- fs/reiserfs/inode.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index c1daedc50f4c..9b43a81a6488 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c @@ -2699,7 +2699,6 @@ static int reiserfs_write_folio(struct folio *folio, } bh = bh->b_this_page; } while (bh != head); - folio_set_error(folio); BUG_ON(folio_test_writeback(folio)); folio_start_writeback(folio); folio_unlock(folio); From patchwork Sat Apr 20 02:50:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636952 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F83217BCC for ; Sat, 20 Apr 2024 02:51:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581463; cv=none; b=gBHMeCCWAQYiqSuAav+A5PJbkrLBIDygX5pJX/TaDvEukpX5WKelRygML5Xthxz5Bra0iKzmZV+jLHKUsLCGeGPZJvPzVUdFn1uXISS7z3T071bCbuVVe2K7hBdbE2L+7e580Yzrn+rwMgpmd4bMAb+az7bXweUY3gW0AuSbAHg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581463; c=relaxed/simple; bh=HXK9SrkeoGYeQqaRCbDyaBLW2cECSXCKLkdh+hbfB5M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=elOVkwCEVtfTK9cFAyhKt+4kXm0wKnWUwU5opskNuT1DIBrWY9qGkTOrEFuDioj9qvfHBUx1jzZtn0NUU/VaqbyZceaBVtNrDvB7SwtSn6SdIFb/buJB4bD+LXZbhnNTji5lWqQTImQvKXbnWo16Ah6Axd0G4cRrWxTIs4kNA8A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=XE0Xk+F0; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="XE0Xk+F0" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=c7vikNugCgi0jVhZmW+/vu+Luq6OpZDlsK0DHYxWiTc=; b=XE0Xk+F0opaZ/PjSoMRB6WvE/j S9w1f2jW0z8uDw1B5SGVpBnWEIenAk+CwgJ73rhRyFPl+GThSQ6RukjWp+44Cf+WBqomV626Y6MmU 8AP1jb1Z8AybHgM6TlvWYaZzPMswYUumE0osoANrqEvivIJRO45bNX8BULu1oGmIz4Dhk0ufGccia wVcqEqtqjYh8vvaXddiI+lDMj/hR1Pry3waENhLLXFkCQaeINaR7GdZPBN7r2ADqJPTQUF2BfvfYX LwatmLmyLewvKTeF2pjY4gCt7+WB0O1f2fY24aqb9Pf1sUX5h/B2orJRF+wGIwDw9ESJ+yvFnju+9 ue8YMSiw==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0oa-000000095g1-24C9; Sat, 20 Apr 2024 02:50:56 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 20/30] romfs: Convert romfs_read_folio() to use a folio Date: Sat, 20 Apr 2024 03:50:15 +0100 Message-ID: <20240420025029.2166544-21-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Remove the conversion back to struct page and use the folio APIs instead of the page APIs. It's probably more trouble than it's worth to support large folios in romfs, so there are still PAGE_SIZE assumptions in this function. Signed-off-by: Matthew Wilcox (Oracle) --- fs/romfs/super.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/fs/romfs/super.c b/fs/romfs/super.c index 2cbb92462074..68758b6fed94 100644 --- a/fs/romfs/super.c +++ b/fs/romfs/super.c @@ -101,19 +101,15 @@ static struct inode *romfs_iget(struct super_block *sb, unsigned long pos); */ static int romfs_read_folio(struct file *file, struct folio *folio) { - struct page *page = &folio->page; - struct inode *inode = page->mapping->host; + struct inode *inode = folio->mapping->host; loff_t offset, size; unsigned long fillsize, pos; void *buf; int ret; - buf = kmap(page); - if (!buf) - return -ENOMEM; + buf = kmap_local_folio(folio, 0); - /* 32 bit warning -- but not for us :) */ - offset = page_offset(page); + offset = folio_pos(folio); size = i_size_read(inode); fillsize = 0; ret = 0; @@ -125,20 +121,14 @@ static int romfs_read_folio(struct file *file, struct folio *folio) ret = romfs_dev_read(inode->i_sb, pos, buf, fillsize); if (ret < 0) { - SetPageError(page); fillsize = 0; ret = -EIO; } } - if (fillsize < PAGE_SIZE) - memset(buf + fillsize, 0, PAGE_SIZE - fillsize); - if (ret == 0) - SetPageUptodate(page); - - flush_dcache_page(page); - kunmap(page); - unlock_page(page); + buf = folio_zero_tail(folio, fillsize, buf); + kunmap_local(buf); + folio_end_read(folio, ret == 0); return ret; } From patchwork Sat Apr 20 02:50:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636949 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9038217735; Sat, 20 Apr 2024 02:51:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581461; cv=none; b=NLN1LKPD8gtylfAfBH/TDyi1pGavSbZ+EPlXwR7Q/myAIIAyVXwqSu8X7r4Tr93pBbTmQMzMqmKkBlaZCO4Gct9gfsrZEnzwj/9mVsug7ezfUjei3+5JNv6pOuxVlB7baKPNrviwAqes+9HRgF1Ldc3/PHK7t4C1EmnJij1u73E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581461; c=relaxed/simple; bh=gDoutF5VcemMF/fu9UMoD/j8LK8EcbrzcqGq7Swrmv4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iNIiMBp0OZRK+gD8Z5gVrXF1P2LUGtxvsF4xJNro8KqZYGXsOBJN+aCX9/DzXCeW5y+seFZiLXq8If481x9PTpD+4S9WIid2MjOAH70LXjwu4KqIt7I2zfEdMNkg1dRQ0nSJsVBQGnocTsSDoXYiQXYeHp/Px0YoSzFhLysNbfo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=qvmGBfbA; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="qvmGBfbA" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=JJUtBb3Yt0yc+VEokI0uWtLP+ciqGPKTapKFG3xz7p0=; b=qvmGBfbAPWp4ZT0CzYcL5igk1q 0aVXlXLl8g6cL4ELWaCjI6Nbr6e4lp2LKop5cApwBXgGhD0h10tgwQsTbU6oKntHok0qZWVM5liHW qhJz/FGPhspjUmc1D2t2qmGH+dho0V02jaqMstt8MYgVGbIt7+yjWM6i9hO6Fl+h5DUTxRzzJz1Ia +0I6cWbYKQSwdIbZByfJup0/XhyFZSHjPAVjGOTR0MpB/KIeXf5M/dxKmnNym1OEpoTf5oTb31l1U CJoFC9NCN8HbfrBMHJ+TTPCOjE/eainlmeDOJ17caw5JiMcm1XogMPzIq/FfsSHF32n8r2XQg/c/4 HU/rwdxQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0ob-000000095gA-2ir4; Sat, 20 Apr 2024 02:50:57 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Steve French , linux-cifs@vger.kernel.org Subject: [PATCH 21/30] smb: Remove calls to set folio error flag Date: Sat, 20 Apr 2024 03:50:16 +0100 Message-ID: <20240420025029.2166544-22-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The folio error flag is never checked for smb folios, so remove calls to set it. Cc: Steve French Cc: linux-cifs@vger.kernel.org Signed-off-by: Matthew Wilcox (Oracle) --- fs/smb/client/file.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c index cf02d981fc13..dce121c5a86a 100644 --- a/fs/smb/client/file.c +++ b/fs/smb/client/file.c @@ -124,7 +124,6 @@ void cifs_pages_write_failed(struct inode *inode, loff_t start, unsigned int len continue; } - folio_set_error(folio); folio_end_writeback(folio); } @@ -3156,7 +3155,6 @@ cifs_writepage_locked(struct page *page, struct writeback_control *wbc) goto retry_write; redirty_page_for_writepage(wbc, page); } else if (rc != 0) { - SetPageError(page); mapping_set_error(page->mapping, rc); } else { SetPageUptodate(page); From patchwork Sat Apr 20 02:50:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636955 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5186B1863F for ; Sat, 20 Apr 2024 02:51:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581465; cv=none; b=kFGxa6x2bcO2NTzxo5C/FRaYlol1/qBmQsQA84ieSE6Rl/MlokZZAs1WmXpZQI+xGRVQr6QCyt6vhohanBgzpRELRBdi/h8WdTRD2Q14owA1FdtWvY4V48qZUhnyPfrwF3jI/jGOZ2KwreP+MM5QHATBzB+OoAfvmdLowZwj1Uc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581465; c=relaxed/simple; bh=Idqxa+/CuIoHgoi7BlUOzrbP2eqRX0jkek5KzpQfEvU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=K3/QUmkLBpxEmk/xEZPWnv8+GmMkOi2Eyo9LBNxKsEXZX/37w/amU//g12anOkvm6ofFno7DI5TG3HN/SMoHJKfd17qwlwqRSdIr3wC1+4Dc2Apo3jX1WyPQa2jghJ0WNsi6lB8IDdNPFHExikaL9QsAVjTXnwpbWcbKUrCkLE4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=jnGYoFwp; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="jnGYoFwp" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=yHXRLPSqUDx/dY1r21WKmlsbaOqpMylngLbXTnW/VC0=; b=jnGYoFwp81x/ROLoLxivKi7bt9 glrD6O92w9hx+9SSwyjfGODFlvYTiFtwd/rH+40NqCxMSUPuFYoOOYehOj4tnJahnBPJ/K3t9g392 m/cHM4ENfB3HAT1hplMPUQooiVLxvZ1fII4y3povUEq5TjCfFUaTQNI3xec+HanXbErvolkpa+AWd nC0KZGxpGYukVG2Fou0eb2v2nqBE5EGvN/CeGNwpwMDl06kKLXuowTzOmHmDauHj3mPMk6Uu3ToyR iNt1fB3Sxl9w00MJjP/PaLWw3sPF6yKjCFncDx4Ta0QEHW8qRl2e5widIk6T4aT3htCAPWnMS/Xqz mJQ0ALOw==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0oc-000000095gJ-1Kdn; Sat, 20 Apr 2024 02:50:58 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Phillip Lougher Subject: [PATCH 22/30] squashfs: Convert squashfs_symlink_read_folio to use folio APIs Date: Sat, 20 Apr 2024 03:50:17 +0100 Message-ID: <20240420025029.2166544-23-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Remove use of page APIs, return the errno instead of 0, switch from kmap_atomic to kmap_local and use folio_end_read() to unify the two exit paths. Cc: Phillip Lougher Signed-off-by: Matthew Wilcox (Oracle) Tested-by: Phillip Lougher Reviewed-by: Phillip Lougher --- fs/squashfs/symlink.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/fs/squashfs/symlink.c b/fs/squashfs/symlink.c index 2bf977a52c2c..6ef735bd841a 100644 --- a/fs/squashfs/symlink.c +++ b/fs/squashfs/symlink.c @@ -32,20 +32,19 @@ static int squashfs_symlink_read_folio(struct file *file, struct folio *folio) { - struct page *page = &folio->page; - struct inode *inode = page->mapping->host; + struct inode *inode = folio->mapping->host; struct super_block *sb = inode->i_sb; struct squashfs_sb_info *msblk = sb->s_fs_info; - int index = page->index << PAGE_SHIFT; + int index = folio_pos(folio); u64 block = squashfs_i(inode)->start; int offset = squashfs_i(inode)->offset; int length = min_t(int, i_size_read(inode) - index, PAGE_SIZE); - int bytes, copied; + int bytes, copied, error; void *pageaddr; struct squashfs_cache_entry *entry; TRACE("Entered squashfs_symlink_readpage, page index %ld, start block " - "%llx, offset %x\n", page->index, block, offset); + "%llx, offset %x\n", folio->index, block, offset); /* * Skip index bytes into symlink metadata. @@ -57,14 +56,15 @@ static int squashfs_symlink_read_folio(struct file *file, struct folio *folio) ERROR("Unable to read symlink [%llx:%x]\n", squashfs_i(inode)->start, squashfs_i(inode)->offset); - goto error_out; + error = bytes; + goto out; } } /* * Read length bytes from symlink metadata. Squashfs_read_metadata * is not used here because it can sleep and we want to use - * kmap_atomic to map the page. Instead call the underlying + * kmap_local to map the folio. Instead call the underlying * squashfs_cache_get routine. As length bytes may overlap metadata * blocks, we may need to call squashfs_cache_get multiple times. */ @@ -75,29 +75,26 @@ static int squashfs_symlink_read_folio(struct file *file, struct folio *folio) squashfs_i(inode)->start, squashfs_i(inode)->offset); squashfs_cache_put(entry); - goto error_out; + error = entry->error; + goto out; } - pageaddr = kmap_atomic(page); + pageaddr = kmap_local_folio(folio, 0); copied = squashfs_copy_data(pageaddr + bytes, entry, offset, length - bytes); if (copied == length - bytes) memset(pageaddr + length, 0, PAGE_SIZE - length); else block = entry->next_index; - kunmap_atomic(pageaddr); + kunmap_local(pageaddr); squashfs_cache_put(entry); } - flush_dcache_page(page); - SetPageUptodate(page); - unlock_page(page); - return 0; - -error_out: - SetPageError(page); - unlock_page(page); - return 0; + flush_dcache_folio(folio); + error = 0; +out: + folio_end_read(folio, error == 0); + return error; } From patchwork Sat Apr 20 02:50:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636950 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ADF99749F for ; Sat, 20 Apr 2024 02:51:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581463; cv=none; b=HCH7GIOK3vYAFlGrEWWSZl9HvReK+KUROcMfHwH6/kXr5gHnv3/U8imFwJzN+0uHUdT6WJOwTV5wEf3+jQxk3WVljlxMWnPQJLvLvOi1AsrXInv5KRERd/W4aC4pRzGVit7KiSVP3cvzxCtjYvL9sZa9IVgcCxLI805IgE1OsnI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581463; c=relaxed/simple; bh=7HzCLQSXn37UUZWfG5ccEbWidAJkw8qNX3ExDEFU1Y4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WjrLOPnK4mgVYRE1J3IGaQny/BnPUuFpfm/Mamw5JzsDnJiz/8BCX3MFnWm+iGKTIaYCvmmCwcOlYCHYGW5wTo56GasaN74A2hF9mSeorIoxWfqwtU245kz1EQDVyVzGUzom+8LCls4xnx6ZYS3+7qgDHF/73p8Nc+hSyB4KgN8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=GreEqp1e; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="GreEqp1e" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=NqXmKbkf+s1gTN27JESMQN4qHz7HkPL9j1SqSG/y14M=; b=GreEqp1emdsLOnFLp8y7LUaYX+ zzyqKbA104KPWpdzsBWpI+T5UTZAHrU0n49bmIc/jiMVWCEpwM+sw/0jC5Tty5v7wJWc+z5ukfcMZ t9Pyuo8/EG6WNoZ5HtoToUbOguFEYrCGMuVnF7IEnCyxQnW+PwPwZB0+iLOBqZRtn+bx03AEoFhaz YNC4K5qrAcaqPLvub8a7k8cnbQk55kXZpQZkzkpluRMHuA7akjOdz34oFQgN01FxPckzpIkL0/RVs 39434OTrrf3KI2lEI1z4pk+39dGYqORix7wFqzZ09C2fWqz9a1V9QR5t4nq7VM1VWNLM+miYtdOfI Io5UTovg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0oc-000000095gR-3sz1; Sat, 20 Apr 2024 02:50:59 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Phillip Lougher Subject: [PATCH 23/30] squashfs: Remove calls to set the folio error flag Date: Sat, 20 Apr 2024 03:50:18 +0100 Message-ID: <20240420025029.2166544-24-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Nobody checks the error flag on squashfs folios, so stop setting it. Cc: Phillip Lougher Signed-off-by: Matthew Wilcox (Oracle) Tested-by: Phillip Lougher Reviewed-by: Phillip Lougher --- fs/squashfs/file.c | 6 +----- fs/squashfs/file_direct.c | 3 +-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/fs/squashfs/file.c b/fs/squashfs/file.c index e8df6430444b..a8c1e7f9a609 100644 --- a/fs/squashfs/file.c +++ b/fs/squashfs/file.c @@ -375,8 +375,6 @@ void squashfs_fill_page(struct page *page, struct squashfs_cache_entry *buffer, flush_dcache_page(page); if (copied == avail) SetPageUptodate(page); - else - SetPageError(page); } /* Copy data into page cache */ @@ -471,7 +469,7 @@ static int squashfs_read_folio(struct file *file, struct folio *folio) res = read_blocklist(inode, index, &block); if (res < 0) - goto error_out; + goto out; if (res == 0) res = squashfs_readpage_sparse(page, expected); @@ -483,8 +481,6 @@ static int squashfs_read_folio(struct file *file, struct folio *folio) if (!res) return 0; -error_out: - SetPageError(page); out: pageaddr = kmap_atomic(page); memset(pageaddr, 0, PAGE_SIZE); diff --git a/fs/squashfs/file_direct.c b/fs/squashfs/file_direct.c index 763a3f7a75f6..2a689ce71de9 100644 --- a/fs/squashfs/file_direct.c +++ b/fs/squashfs/file_direct.c @@ -106,14 +106,13 @@ int squashfs_readpage_block(struct page *target_page, u64 block, int bsize, return 0; mark_errored: - /* Decompression failed, mark pages as errored. Target_page is + /* Decompression failed. Target_page is * dealt with by the caller */ for (i = 0; i < pages; i++) { if (page[i] == NULL || page[i] == target_page) continue; flush_dcache_page(page[i]); - SetPageError(page[i]); unlock_page(page[i]); put_page(page[i]); } From patchwork Sat Apr 20 02:50:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636951 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0979A17BAE for ; Sat, 20 Apr 2024 02:51:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581463; cv=none; b=ArZ/ojZ4l3aAfFo/HJk+yMoOq1a5OHnCUVXYwLdkUsHx7MxrSnKabRrmLl0zVO+QBFx5APwacUSDzqwVFMUE+3Rbx+ogwP0qPmMgD9+wmVs1WeuxVsN2iIDwR7EJ59GmYQkRAQgj6UfqUhW0Rm7gqzcn9IIqP1WmdhbAEpQdebQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581463; c=relaxed/simple; bh=WdKGX7UsrMBGTyHTctOYjOqge8sOsjhllPvtQJOQZPM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QYljDP23uZwJjV5E93VLjrMIiRwDXMbRbGy7uNYx//NPUKZrvSfxbe0MkjqGeO1eHMw0LD4B4GgMATHsjFM8wtq3Wn9/FR19HDWefU0/ZzWSQg1h84nzyPeRURpqgJ7LwaIam0WtelQCTQyxM7imXf+fslL2CY9tsX9G0A2M5jk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=BEbyqyoC; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="BEbyqyoC" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=a7yHNOZFt+0LQm68oxpHbAaQyBDUjkgZ9Hyez6IHxQc=; b=BEbyqyoCId2WqYzoaJjWRb+qA5 19iqFDbNtyxP81P0/448sKvcUwtmOEy6lcpHDCn/z9TttDxkRB6e6MOCLVzzvQnCF/CLGf5kkAOL/ bCz6KiWshttU9WH4Mf+FvJ9tI9mnfdeid2SibhbSgblnqp909WRjPVHjy/RmEtKPj6z8bCks0Qht3 IVdca2y2FiG+F4PqLqT5OMhn5pU2l7ZmiPz2TJgd3mZPomnR6A+JqX95A1EQNGfigZ+iyT5MDCoh/ vkFBg1BWq+AIU+8m/wLhNUlNCg/0TyNQXtusYvQSPqh1tSUDGCdzIudMaVG5+0TgeEMtFuxOgiEgd NZx7T+8A==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0od-000000095gW-1JDd; Sat, 20 Apr 2024 02:50:59 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Evgeniy Dushistov Subject: [PATCH 24/30] ufs: Remove call to set the folio error flag Date: Sat, 20 Apr 2024 03:50:19 +0100 Message-ID: <20240420025029.2166544-25-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Nobody checks the error flag on ufs folios, so stop setting it. Cc: Evgeniy Dushistov Signed-off-by: Matthew Wilcox (Oracle) --- fs/ufs/dir.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c index 27c85d92d1dc..61f25d3cf3f7 100644 --- a/fs/ufs/dir.c +++ b/fs/ufs/dir.c @@ -188,7 +188,6 @@ static bool ufs_check_page(struct page *page) "offset=%lu", dir->i_ino, (page->index< X-Patchwork-Id: 13636959 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BDD0A2941E for ; Sat, 20 Apr 2024 02:51:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581469; cv=none; b=O7AAOTUMpQK+n5KidcekbRtBJP1JwY1dSlbNm8yVxYEVeJQA6w+WHEU+CB5vnsjvF+Pu9hN2lY+Lh8dMYHM6TepQ09n7OXV2qtqQHrDb92teZMS00Gobs7xfHftX4Cn1V03ir231DIPimkuSAp/4puUNa1oEFUKHZuMcpbFxIVc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581469; c=relaxed/simple; bh=w/a8xk8cry5wKM19zZntvWj1Gp/2jqHAfGvf1Bpt1Gc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aI8AjIZBQNWv5lh9xf37JWSQhDvLyJV4gIBcizGHktV8CBH9hloXKpdPAJdi8tOU5XeJ+TUzHyERloeeCTw4NzBs1CEyB05cm7v3evCOreHbgv0gxXtPV+ClE99VVksD45cD/VlhVDjStIpgkAWzHavzJyIdJ/D79Or9GL42r7Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=HVFavhfb; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="HVFavhfb" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=/oTsqWZYEd80eXNdCVOXPUSFuXiId5+9LC3D93HN0Xw=; b=HVFavhfbsOhcbBCC1DsA01mBz+ diQpTokTxyNcTF45mBtvTt2VVtc0l1doPvaj8qmXYq4MBYGZ/rojeMzZieYkIm+bunMaDQh8g3HyF 7mChMy1SniJjWf3U15+fFvBjDuWifefMBfBzfXQysr23O9eWH10+Q5hft18b5QUlf6I8mKnaIG4f4 Svi/JoEQGxIMbzwmjBfTdQmnCm1G+SKjrGcajbxdfmaJMmt2Bbtm1TsJAzIP3LwRmvp35zOG4wPKi skebIXgq1T2HnaKbuICrkjXGSv0iXqTxQwJOzlDyoArNxBFA/h3FuHXRtbA8FPmqz9+3Ma7RwcTI6 Qvk7wNYQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0od-000000095ga-44LH; Sat, 20 Apr 2024 02:51:00 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Hans de Goede Subject: [PATCH 25/30] vboxsf: Convert vboxsf_read_folio() to use a folio Date: Sat, 20 Apr 2024 03:50:20 +0100 Message-ID: <20240420025029.2166544-26-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Remove conversion to a page and use folio APIs throughout. This includes a removal of setting the error flag as nobody checks the error flag on vboxsf folios. This does not include large folio support as we would have to map each page individually. Cc: Hans de Goede Signed-off-by: Matthew Wilcox (Oracle) Tested-by: Hans de Goede Reviewed-by: Hans de Goede --- fs/vboxsf/file.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/fs/vboxsf/file.c b/fs/vboxsf/file.c index 118dedef8ebe..e149158b105d 100644 --- a/fs/vboxsf/file.c +++ b/fs/vboxsf/file.c @@ -228,26 +228,19 @@ const struct inode_operations vboxsf_reg_iops = { static int vboxsf_read_folio(struct file *file, struct folio *folio) { - struct page *page = &folio->page; struct vboxsf_handle *sf_handle = file->private_data; - loff_t off = page_offset(page); + loff_t off = folio_pos(folio); u32 nread = PAGE_SIZE; u8 *buf; int err; - buf = kmap(page); + buf = kmap_local_folio(folio, 0); err = vboxsf_read(sf_handle->root, sf_handle->handle, off, &nread, buf); - if (err == 0) { - memset(&buf[nread], 0, PAGE_SIZE - nread); - flush_dcache_page(page); - SetPageUptodate(page); - } else { - SetPageError(page); - } + buf = folio_zero_tail(folio, nread, buf); - kunmap(page); - unlock_page(page); + kunmap_local(buf); + folio_end_read(folio, err == 0); return err; } @@ -295,7 +288,6 @@ static int vboxsf_writepage(struct page *page, struct writeback_control *wbc) kref_put(&sf_handle->refcount, vboxsf_handle_release); if (err == 0) { - ClearPageError(page); /* mtime changed */ sf_i->force_restat = 1; } else { From patchwork Sat Apr 20 02:50:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636957 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 571AB17C69 for ; Sat, 20 Apr 2024 02:51:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581466; cv=none; b=tsQ6/CN1HT8yvZlVUdJvfx19McLzDFf+xd/cPc4Dg+hXItEBNt8YylmUNNCbVBJQtx6y6++vWVyn4KZ+knvblzs2qbvkpj45LHDzzMb53PY0M0owPqBWAFBg7ohdKNtPzmbAK+uYJnARrNTKuMTLWkZBVUn2C94Gvf0Nldx4GqE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581466; c=relaxed/simple; bh=41a/0SgujA/3O6m5BW8LSiYQoeLxaFQClmNrnbg8ivI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GOEcXoOdq5VaHOn3/pRaO2Salp5Iv4qnyPmtEDNOFs19igMyVFpz0Era5WHmN1rdYgXyXv28bTnq3ZRns01/39GRJhKIR3ODj2jn3VOz/Pq0vPjLn6DoH8Mkehr/xZakMKHCvZsnniucW3Dk5TneBFB1ejThSBg0lzeE5EuUdaw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=vqdJT0nE; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="vqdJT0nE" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=KHvcC88/pFabYoyBrEUaVAQ7LuFYjaoB++gJdYEMqMk=; b=vqdJT0nEXCKSdIsJzTGyeB8zZb 7ce6yZkOlsM/ZJe9kVOk3cGuSBx0iufVxvmEnXhkX4y+RXp1LRADSafM9rEGBg9s0uP0dhg3+Y1xo Set/EFY76hIoKb/AeznBt9DP6kDkioRbtMYJZW8hwyzUHHvA6jk6HBcwVlcTAiUT5dA9iQ8RfcozM JL4F7LB6P/7eDCiWDL30wjjJmrgO3idiDnfo8O+azSzAz0M+Ov5FRVMOKZgMuO63YP4qbi139O6xw 5Jsy15obZODuLOL2WIxKlfb6GU8bodz6FqD4x5o4twVQJlnCxJI629dMpbi+zl4zXo8xkrCuHtPOv 4QCexmfA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0oe-000000095gf-1OC7; Sat, 20 Apr 2024 02:51:00 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Miaohe Lin , linux-mm@kvack.org Subject: [PATCH 26/30] mm/memory-failure: Stop setting the folio error flag Date: Sat, 20 Apr 2024 03:50:21 +0100 Message-ID: <20240420025029.2166544-27-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Nobody checks the error flag any more, so setting it accomplishes nothing. Remove the obsolete parts of this comment; it hasn't been true since errseq_t was used to track writeback errors in 2017. Cc: Miaohe Lin Cc: linux-mm@kvack.org Signed-off-by: Matthew Wilcox (Oracle) --- mm/memory-failure.c | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index ec30611ec5ad..e065dd9be21e 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1092,7 +1092,6 @@ static int me_pagecache_dirty(struct page_state *ps, struct page *p) { struct address_space *mapping = page_mapping(p); - SetPageError(p); /* TBD: print more information about the file. */ if (mapping) { /* @@ -1100,34 +1099,6 @@ static int me_pagecache_dirty(struct page_state *ps, struct page *p) * who check the mapping. * This way the application knows that something went * wrong with its dirty file data. - * - * There's one open issue: - * - * The EIO will be only reported on the next IO - * operation and then cleared through the IO map. - * Normally Linux has two mechanisms to pass IO error - * first through the AS_EIO flag in the address space - * and then through the PageError flag in the page. - * Since we drop pages on memory failure handling the - * only mechanism open to use is through AS_AIO. - * - * This has the disadvantage that it gets cleared on - * the first operation that returns an error, while - * the PageError bit is more sticky and only cleared - * when the page is reread or dropped. If an - * application assumes it will always get error on - * fsync, but does other operations on the fd before - * and the page is dropped between then the error - * will not be properly reported. - * - * This can already happen even without hwpoisoned - * pages: first on metadata IO errors (which only - * report through AS_EIO) or when the page is dropped - * at the wrong time. - * - * So right now we assume that the application DTRT on - * the first EIO, but we're not worse than other parts - * of the kernel. */ mapping_set_error(mapping, -EIO); } From patchwork Sat Apr 20 02:50:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636953 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B520175B1; Sat, 20 Apr 2024 02:51:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581464; cv=none; b=OhD3UozBUE/wScosGpTSo1Y5GJm/TqjHF/hurJc5xVYKwOQ4JXgmvAhIHctZOs7ZBBn9yNRkLt8RK/Wp+xWSmph6e3GfOuFRRAtJkNlV4j8Tj+CpVoC1hB6t0oZq5Cc0dtCobWgpwdgup6l8TKOuX9xAKFKfH7Qa5DCdgf4LUZs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581464; c=relaxed/simple; bh=toMdXVVbMSmwIquWLakJqRRQoi2rF0RQdjBZap1Oh2Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jfT/BrIlBHnvxYfIQzmeRs7aEALB+j/hbDAt1hJ7lDhlaBkyW9oC1VWkKco5TduhRnm/4eH9NE1J6gsmcO6UJHC2JoO+pck9xObYdS7v5xSn5MExQWtOu4VjE8mtRbdhFHigA2cGB6NikEJtioLY3HCdoPZNn6pRFOGdNz5Kz9g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=TczbW4PL; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="TczbW4PL" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=Y3koETGNEc6+Xt3EmtpJdafmmHLWcDXIyu/5s+XhzTg=; b=TczbW4PLKKu+hylU0BwlAV2amo DwhH/JX8X+r4zu2oNK2mgKDLCxQLGrEPgoo5ApbGCMs319jP1LuqkkMBV3iOSvWCmFe9itRCGM/dB oFIzqCunQnJN9G+ZDApOZ+sEhRpZUrDL1AzO9zpP+y1Gpxltxp2bq2GMCMt+TJltAk6x5Cy5vQXM3 KA6xmfhFqE/hcYI3lCOamj5xfRPiaygn+U+kBtMwbSYbMuPFb6ZclfUZOhcQPf49yGl1aaP+U4B91 GM50G7bZkjwPZ243iqg4v6dptSECi4E3Rsq9wb/nlpjNnaerErPzw7QLX4Tu8hj2B4IXaGAKPPr0P JKBM8B6w==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0oe-000000095gm-46Ed; Sat, 20 Apr 2024 02:51:01 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , Christian Brauner , "Darrick J . Wong" , linux-xfs@vger.kernel.org Subject: [PATCH 27/30] iomap: Remove calls to set and clear folio error flag Date: Sat, 20 Apr 2024 03:50:22 +0100 Message-ID: <20240420025029.2166544-28-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The folio error flag is not checked anywhere, so we can remove the calls to set and clear it. Cc: Christian Brauner Cc: Darrick J. Wong Cc: linux-xfs@vger.kernel.org Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Darrick J. Wong --- fs/iomap/buffered-io.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 4e8e41c8b3c0..41352601f939 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -306,8 +306,6 @@ static void iomap_finish_folio_read(struct folio *folio, size_t off, spin_unlock_irqrestore(&ifs->state_lock, flags); } - if (error) - folio_set_error(folio); if (finished) folio_end_read(folio, uptodate); } @@ -460,9 +458,6 @@ int iomap_read_folio(struct folio *folio, const struct iomap_ops *ops) while ((ret = iomap_iter(&iter, ops)) > 0) iter.processed = iomap_readpage_iter(&iter, &ctx, 0); - if (ret < 0) - folio_set_error(folio); - if (ctx.bio) { submit_bio(ctx.bio); WARN_ON_ONCE(!ctx.cur_folio_in_bio); @@ -697,7 +692,6 @@ static int __iomap_write_begin(const struct iomap_iter *iter, loff_t pos, if (folio_test_uptodate(folio)) return 0; - folio_clear_error(folio); do { iomap_adjust_read_range(iter->inode, folio, &block_start, @@ -1528,8 +1522,6 @@ iomap_finish_ioend(struct iomap_ioend *ioend, int error) /* walk all folios in bio, ending page IO on them */ bio_for_each_folio_all(fi, bio) { - if (error) - folio_set_error(fi.folio); iomap_finish_folio_write(inode, fi.folio, fi.length); folio_count++; } From patchwork Sat Apr 20 02:50:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636954 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C75C118041 for ; Sat, 20 Apr 2024 02:51:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581465; cv=none; b=AisGN1kQS8wYp4kc+PR/xDntAbV63f6Pe0Gds5+GAVwTq8FA7bsvhBOf6VkS7mej7V+wZy6X3VKLEVZxwPnlsA7j56UrIfiuxvkVoCdRUytRl6jJzMVgWFkdflm3OhZ9LjHLXx5wBSVLgiR73nqKbAOxS4rG9IyDV0MZOUUiaKw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581465; c=relaxed/simple; bh=jmkLAvPrdLWlWqTzNE06H6Rn/KwJNLwtwvybi/ipsCM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cb550VVg+vw/qZrnlIY2tX4lslgnjKGt3uQPD/SD3SF1/X259g7+DXQqQ1TM+kZUkurzLCXVbp/WgFE1k4ga/cE9Gwh3MQ2TSAUT78OUPW64K7gnn1+n+cR9l51SeojLiqSQa4n9eCUwIu8i09u7JPzQuhJZfd/VdiN1J5MeNc4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=C5wbPShr; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="C5wbPShr" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=KGeOgQ8YggiCIqvYt1WMf5unqJXOMCcuZ08I4TBl4Tk=; b=C5wbPShrtknnLOHiIrrkDv3jXe XQPvq0JIRQwL+Cth8/Xzix5UgurkM1bLigU3ckvdf50ylXKh2QeJ+IhoskYcoph842c4tTcBbIRJk qZ+t8mTJJ9zkADeKOlUaAHQ/31WH8AJ/oRbxryyl9wOpPi3dqjouVAOzRzu1ekyC47vgVfft3JHR+ y9YiDpWU8fWDTnpvUm+3lZGlMsqxL7Tx3/28N0IMzSh5bX85AijCxzv1adAh32MAFT8MZ9Y6yZvg9 mhMbc15TyisITysj5BKDFYLcxZDcZLM18/J+0/kgwJFSMr0fApT6m4zWqCHgCtarTgkPL1u79LEnl BtjUmdkA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0of-000000095gq-1xMr; Sat, 20 Apr 2024 02:51:01 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 28/30] buffer: Remove calls to set and clear the folio error flag Date: Sat, 20 Apr 2024 03:50:23 +0100 Message-ID: <20240420025029.2166544-29-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The folio error flag is not tested anywhere, so we can stop setting and clearing it. Signed-off-by: Matthew Wilcox (Oracle) --- fs/buffer.c | 7 +------ fs/mpage.c | 13 +++---------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index 592741d4b88a..26face6ccb3a 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -258,7 +258,6 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate) } else { clear_buffer_uptodate(bh); buffer_io_error(bh, ", async page read"); - folio_set_error(folio); } /* @@ -391,7 +390,6 @@ static void end_buffer_async_write(struct buffer_head *bh, int uptodate) buffer_io_error(bh, ", lost async page write"); mark_buffer_write_io_error(bh); clear_buffer_uptodate(bh); - folio_set_error(folio); } first = folio_buffers(folio); @@ -1960,7 +1958,6 @@ int __block_write_full_folio(struct inode *inode, struct folio *folio, clear_buffer_dirty(bh); } } while ((bh = bh->b_this_page) != head); - folio_set_error(folio); BUG_ON(folio_test_writeback(folio)); mapping_set_error(folio->mapping, err); folio_start_writeback(folio); @@ -2406,10 +2403,8 @@ int block_read_full_folio(struct folio *folio, get_block_t *get_block) if (iblock < lblock) { WARN_ON(bh->b_size != blocksize); err = get_block(inode, iblock, bh, 0); - if (err) { - folio_set_error(folio); + if (err) page_error = true; - } } if (!buffer_mapped(bh)) { folio_zero_range(folio, i * blocksize, diff --git a/fs/mpage.c b/fs/mpage.c index fa8b99a199fa..b5b5ddf9d513 100644 --- a/fs/mpage.c +++ b/fs/mpage.c @@ -48,13 +48,8 @@ static void mpage_read_end_io(struct bio *bio) struct folio_iter fi; int err = blk_status_to_errno(bio->bi_status); - bio_for_each_folio_all(fi, bio) { - if (err) - folio_set_error(fi.folio); - else - folio_mark_uptodate(fi.folio); - folio_unlock(fi.folio); - } + bio_for_each_folio_all(fi, bio) + folio_end_read(fi.folio, err == 0); bio_put(bio); } @@ -65,10 +60,8 @@ static void mpage_write_end_io(struct bio *bio) int err = blk_status_to_errno(bio->bi_status); bio_for_each_folio_all(fi, bio) { - if (err) { - folio_set_error(fi.folio); + if (err) mapping_set_error(fi.folio->mapping, err); - } folio_end_writeback(fi.folio); } From patchwork Sat Apr 20 02:50:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636958 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F88129417 for ; Sat, 20 Apr 2024 02:51:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581468; cv=none; b=aBdUL8PUC7mOTxAAN84OetGmHFcuX2rj1ZqBM3aafOtXL8moGRMEQxvjSPSXYTye9yBl4VDFPuh32OgsMSTUNjt20mQ3eX1myPa96RocBGumD+b/RItHu90D2p8PipF9F6vq/ZDjHR0tm1IKekPD0AonPd5RykbklSPuKT3D56I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581468; c=relaxed/simple; bh=G5OBVcxK4D0JMoz115O1cPyfxqSq7kONY+dLeVFp+T8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uWhlrdQlrKw4rTd2AxArLuVvlGw3JQ4e/ZAUOLQVhfJ/cUUAo3z4LYPhn6dIxFhM7KXpXS9fdr0AEPhMmGhZHLLwDr9tlobAqDxuqwtR81P/1GqTv3IIuKCvXfbz3xpRg8kj3UVD1T7vKuxH3cyzwAV6np3AR1A/UeYi2MRfFt4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=S43ZRVEm; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="S43ZRVEm" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=G9CKTeM4M0IHsldWj9g7eJFdQO2VrtDywwK1bhHPzcg=; b=S43ZRVEmGLWt4Guyp/aV3ynNaJ 87HAlPxLT1zNvUw7hIhMKqTx7XFHR/bXPsiC1U1c7xC0mZmn/zUgSJpxp3tmKTzXP4TPoN6rcb+dA uv/NIAZVntm178wuEPpBLzJR7VwjpKavHEWqHNQx31pge/F+NhPZAM+kFJ1qAWukmRmVOOBAKvdPO ypXn3zI8QAjduy3dk+CaW7ngz6a+YY3juvGNqjFsLOyeQa+j4fOVy7XoZqMq7f/miszODuSX00V2N s7l1YmoioNVLn8U/97oPi1+Kyh7HvE8XAoUNk9f+nyA/b0Y+blLLgTh+f76u1CHJSFJjkqA4ekU9V jyMU5gpw==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0of-000000095gw-3jgL; Sat, 20 Apr 2024 02:51:02 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 29/30] fs: Remove calls to set and clear the folio error flag Date: Sat, 20 Apr 2024 03:50:24 +0100 Message-ID: <20240420025029.2166544-30-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Nobody checks the folio error flag any more, so we can stop setting and clearing it. Also remove the documentation suggesting to not bother setting the error bit. Signed-off-by: Matthew Wilcox (Oracle) --- Documentation/filesystems/vfs.rst | 3 +-- mm/filemap.c | 8 -------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/Documentation/filesystems/vfs.rst b/Documentation/filesystems/vfs.rst index 6e903a903f8f..a6022ec59a2d 100644 --- a/Documentation/filesystems/vfs.rst +++ b/Documentation/filesystems/vfs.rst @@ -913,8 +913,7 @@ cache in your filesystem. The following members are defined: stop attempting I/O, it can simply return. The caller will remove the remaining pages from the address space, unlock them and decrement the page refcount. Set PageUptodate if the I/O - completes successfully. Setting PageError on any page will be - ignored; simply unlock the page if an I/O error occurs. + completes successfully. ``write_begin`` Called by the generic buffered write code to ask the filesystem diff --git a/mm/filemap.c b/mm/filemap.c index fc784259f278..f8d0cc980044 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -530,7 +530,6 @@ static void __filemap_fdatawait_range(struct address_space *mapping, struct folio *folio = fbatch.folios[i]; folio_wait_writeback(folio); - folio_clear_error(folio); } folio_batch_release(&fbatch); cond_resched(); @@ -2342,13 +2341,6 @@ static int filemap_read_folio(struct file *file, filler_t filler, unsigned long pflags; int error; - /* - * A previous I/O error may have been due to temporary failures, - * eg. multipath errors. PG_error will be set again if read_folio - * fails. - */ - folio_clear_error(folio); - /* Start the actual read. The read will unlock the page. */ if (unlikely(workingset)) psi_memstall_enter(&pflags); From patchwork Sat Apr 20 02:50:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13636956 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C037E199C7 for ; Sat, 20 Apr 2024 02:51:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581466; cv=none; b=uBY9oiSGA2wRwy6QbXZm/9FaRBloRkS9lZkCet1reLKdZzroi5vksbv/u66u0eRnZELniJVlinCPtWG6cp24WZ0hznPYHAWAktcuNQwMLmI/61NwGZCWPw5ejQxDDQ0i+FFi9hViTmE4u0zffTThqLf9yLXlljN/dFk1HIT13m8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713581466; c=relaxed/simple; bh=benssiDwMQD78ZuwTIOs6vpaSfYkzmdv4DjzHfx326M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qPGiUYrLV28/uSv5vZo1LHsc32YYCljwOogUNBfnlUVvPPMkfqxZDAfYsBlnpIcyKo08gWMIlY0u7XEeXRynUp1LUln4T29lALVBt38iPz2/8PZtZHM4/sEwETdCoGlnpGv1Neo4fWI/WOB2hIv9vfI//wXIapsxBJqvzSGcazI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=s3iILuB+; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="s3iILuB+" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=s2FH+8vqQm67u6hInWQscZRvoUgnyhqNAlj8cATZmvM=; b=s3iILuB+2U9U5Sf+rSqY//nvsg qKv7z72lINSg/Rl6cxNpLaALWFeGolmsQnNBzHaqmn8hI5tmv5N6TELdls0mwGfdIGszHNFspAcu9 PfSYZLR6vcA+6YiVXzrB8j8u1MrsEvKLBzCUDd6SFfuZ2nHrEcyW/NjC/BPL9kANsR4ofd2NPr9+2 arReARGEPhMGwnGz/Ng5n1eOGyh79nnjxnXxG7/jyLEeP5a3k2btQrAbwadEiMyj/icWxAQ1IrtEX HHHkODNqPfrYFDUn2GHAteEQ7J6QO845iY+6zhmmP2EHZCXB2ll9xIgxe45UnyETCfYAp4S4OGwcP q3UNTH3A==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ry0og-000000095h1-2jVl; Sat, 20 Apr 2024 02:51:02 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 30/30] mm: Remove PG_error Date: Sat, 20 Apr 2024 03:50:25 +0100 Message-ID: <20240420025029.2166544-31-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240420025029.2166544-1-willy@infradead.org> References: <20240420025029.2166544-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The PG_error bit is now unused; delete it and free up a bit in page->flags. Cc: linux-mm@kvack.org Signed-off-by: Matthew Wilcox (Oracle) --- fs/proc/page.c | 1 - include/linux/page-flags.h | 6 +----- include/trace/events/mmflags.h | 1 - include/uapi/linux/kernel-page-flags.h | 2 +- mm/migrate.c | 2 -- 5 files changed, 2 insertions(+), 10 deletions(-) diff --git a/fs/proc/page.c b/fs/proc/page.c index 2fb64bdb64eb..05eb6617668a 100644 --- a/fs/proc/page.c +++ b/fs/proc/page.c @@ -186,7 +186,6 @@ u64 stable_page_flags(const struct page *page) #endif u |= kpf_copy_bit(k, KPF_LOCKED, PG_locked); - u |= kpf_copy_bit(k, KPF_ERROR, PG_error); u |= kpf_copy_bit(k, KPF_DIRTY, PG_dirty); u |= kpf_copy_bit(k, KPF_UPTODATE, PG_uptodate); u |= kpf_copy_bit(k, KPF_WRITEBACK, PG_writeback); diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index a9a6e0f7367e..931820c8ea95 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -71,8 +71,6 @@ * PG_referenced, PG_reclaim are used for page reclaim for anonymous and * file-backed pagecache (see mm/vmscan.c). * - * PG_error is set to indicate that an I/O error occurred on this page. - * * PG_arch_1 is an architecture specific page state bit. The generic code * guarantees that this bit is cleared for a page when it first is entered into * the page cache. @@ -108,7 +106,6 @@ enum pageflags { PG_waiters, /* Page has waiters, check its waitqueue. Must be bit #7 and in the same byte as "PG_locked" */ PG_active, PG_workingset, - PG_error, PG_owner_priv_1, /* Owner use. If pagecache, fs may use*/ PG_arch_1, PG_reserved, @@ -188,7 +185,7 @@ enum pageflags { */ /* At least one page in this folio has the hwpoison flag set */ - PG_has_hwpoisoned = PG_error, + PG_has_hwpoisoned = PG_active, PG_large_rmappable = PG_workingset, /* anon or file-backed */ }; @@ -511,7 +508,6 @@ static inline int TestClearPage##uname(struct page *page) { return 0; } __PAGEFLAG(Locked, locked, PF_NO_TAIL) FOLIO_FLAG(waiters, FOLIO_HEAD_PAGE) -PAGEFLAG(Error, error, PF_NO_TAIL) TESTCLEARFLAG(Error, error, PF_NO_TAIL) PAGEFLAG(Referenced, referenced, PF_HEAD) TESTCLEARFLAG(Referenced, referenced, PF_HEAD) __SETPAGEFLAG(Referenced, referenced, PF_HEAD) diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h index e46d6e82765e..4f2a18a11970 100644 --- a/include/trace/events/mmflags.h +++ b/include/trace/events/mmflags.h @@ -100,7 +100,6 @@ #define __def_pageflag_names \ DEF_PAGEFLAG_NAME(locked), \ DEF_PAGEFLAG_NAME(waiters), \ - DEF_PAGEFLAG_NAME(error), \ DEF_PAGEFLAG_NAME(referenced), \ DEF_PAGEFLAG_NAME(uptodate), \ DEF_PAGEFLAG_NAME(dirty), \ diff --git a/include/uapi/linux/kernel-page-flags.h b/include/uapi/linux/kernel-page-flags.h index 6f2f2720f3ac..ff8032227876 100644 --- a/include/uapi/linux/kernel-page-flags.h +++ b/include/uapi/linux/kernel-page-flags.h @@ -7,7 +7,7 @@ */ #define KPF_LOCKED 0 -#define KPF_ERROR 1 +#define KPF_ERROR 1 /* Now unused */ #define KPF_REFERENCED 2 #define KPF_UPTODATE 3 #define KPF_DIRTY 4 diff --git a/mm/migrate.c b/mm/migrate.c index 2594a00279f1..c0acb52ac4e4 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -561,8 +561,6 @@ void folio_migrate_flags(struct folio *newfolio, struct folio *folio) { int cpupid; - if (folio_test_error(folio)) - folio_set_error(newfolio); if (folio_test_referenced(folio)) folio_set_referenced(newfolio); if (folio_test_uptodate(folio))