From nobody Tue May 5 11:31:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 549F2C433F5 for ; Sun, 29 May 2022 05:56:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230419AbiE2F4V (ORCPT ); Sun, 29 May 2022 01:56:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230399AbiE2F4S (ORCPT ); Sun, 29 May 2022 01:56:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1A6F6B0A2 for ; Sat, 28 May 2022 22:56:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 358F3B8085B for ; Sun, 29 May 2022 05:56:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14116C34119; Sun, 29 May 2022 05:56:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653803773; bh=amPGy2cvxos9O4S7PoD7U4xa2f9tjDNJm/zivn/cku0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NQ92FUYnCmD99dRrN0EKMWexEBIDdoM2RzKUqBrzVC7pkS+Z6IVHakzShhwBLvEJ7 dVM7pOxPtGGwlaSQoWBbRf/L6P1vaj3i0DNBuipiXdzNBNRclzuckaJe6VD/g5CtEQ YTenH9AVirxLCKZ/tlpmPo68ZgnZBJf66bhAHUjjvW+9lZ1NrA9BgQqfVoo5A4441X DKpwrzhfhR2yYFRlhL/Ob/1dKb4tr1vHRXW5mAtXUXSXthNNEmiceP1pxfTu+nVVsw oOyTJMGeOH8GsNRb0Hh63eLhQwPY1c//vpVdXX8xxW9fJsiRqF3IYw94mxp9637ACN uwzUH/0o9+8iw== From: Gao Xiang To: linux-erofs@lists.ozlabs.org, Chao Yu Cc: linux-kernel@vger.kernel.org, Gao Xiang Subject: [PATCH 1/3] erofs: get rid of `struct z_erofs_collection' Date: Sun, 29 May 2022 13:54:23 +0800 Message-Id: <20220529055425.226363-2-xiang@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220529055425.226363-1-xiang@kernel.org> References: <20220529055425.226363-1-xiang@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Gao Xiang It was incompletely introduced for deduplication between different logical extents backed with the same pcluster. We will have a better in-memory representation in the next release cycle for this, as well as partial memory folios support. So get rid of it instead. No logic changes. Signed-off-by: Gao Xiang Acked-by: Chao Yu --- fs/erofs/zdata.c | 111 ++++++++++++++++++----------------------------- fs/erofs/zdata.h | 50 ++++++++++----------- 2 files changed, 65 insertions(+), 96 deletions(-) diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index e6dea6dfca16..4fd66a66c5f9 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -199,7 +199,6 @@ struct z_erofs_decompress_frontend { struct z_erofs_pagevec_ctor vector; =20 struct z_erofs_pcluster *pcl, *tailpcl; - struct z_erofs_collection *cl; /* a pointer used to pick up inplace I/O pages */ struct page **icpage_ptr; z_erofs_next_pcluster_t owned_head; @@ -357,7 +356,7 @@ static bool z_erofs_try_inplace_io(struct z_erofs_decom= press_frontend *fe, return false; } =20 -/* callers must be with collection lock held */ +/* callers must be with pcluster lock held */ static int z_erofs_attach_page(struct z_erofs_decompress_frontend *fe, struct page *page, enum z_erofs_page_type type, bool pvec_safereuse) @@ -372,7 +371,7 @@ static int z_erofs_attach_page(struct z_erofs_decompres= s_frontend *fe, =20 ret =3D z_erofs_pagevec_enqueue(&fe->vector, page, type, pvec_safereuse); - fe->cl->vcnt +=3D (unsigned int)ret; + fe->pcl->vcnt +=3D (unsigned int)ret; return ret ? 0 : -EAGAIN; } =20 @@ -405,12 +404,11 @@ static void z_erofs_try_to_claim_pcluster(struct z_er= ofs_decompress_frontend *f) f->mode =3D COLLECT_PRIMARY; } =20 -static int z_erofs_lookup_collection(struct z_erofs_decompress_frontend *f= e, - struct inode *inode, - struct erofs_map_blocks *map) +static int z_erofs_lookup_pcluster(struct z_erofs_decompress_frontend *fe, + struct inode *inode, + struct erofs_map_blocks *map) { struct z_erofs_pcluster *pcl =3D fe->pcl; - struct z_erofs_collection *cl; unsigned int length; =20 /* to avoid unexpected loop formed by corrupted images */ @@ -419,8 +417,7 @@ static int z_erofs_lookup_collection(struct z_erofs_dec= ompress_frontend *fe, return -EFSCORRUPTED; } =20 - cl =3D z_erofs_primarycollection(pcl); - if (cl->pageofs !=3D (map->m_la & ~PAGE_MASK)) { + if (pcl->pageofs_out !=3D (map->m_la & ~PAGE_MASK)) { DBG_BUGON(1); return -EFSCORRUPTED; } @@ -443,23 +440,21 @@ static int z_erofs_lookup_collection(struct z_erofs_d= ecompress_frontend *fe, length =3D READ_ONCE(pcl->length); } } - mutex_lock(&cl->lock); + mutex_lock(&pcl->lock); /* used to check tail merging loop due to corrupted images */ if (fe->owned_head =3D=3D Z_EROFS_PCLUSTER_TAIL) fe->tailpcl =3D pcl; =20 z_erofs_try_to_claim_pcluster(fe); - fe->cl =3D cl; return 0; } =20 -static int z_erofs_register_collection(struct z_erofs_decompress_frontend = *fe, - struct inode *inode, - struct erofs_map_blocks *map) +static int z_erofs_register_pcluster(struct z_erofs_decompress_frontend *f= e, + struct inode *inode, + struct erofs_map_blocks *map) { bool ztailpacking =3D map->m_flags & EROFS_MAP_META; struct z_erofs_pcluster *pcl; - struct z_erofs_collection *cl; struct erofs_workgroup *grp; int err; =20 @@ -482,17 +477,15 @@ static int z_erofs_register_collection(struct z_erofs= _decompress_frontend *fe, =20 /* new pclusters should be claimed as type 1, primary and followed */ pcl->next =3D fe->owned_head; + pcl->pageofs_out =3D map->m_la & ~PAGE_MASK; fe->mode =3D COLLECT_PRIMARY_FOLLOWED; =20 - cl =3D z_erofs_primarycollection(pcl); - cl->pageofs =3D map->m_la & ~PAGE_MASK; - /* * lock all primary followed works before visible to others * and mutex_trylock *never* fails for a new pcluster. */ - mutex_init(&cl->lock); - DBG_BUGON(!mutex_trylock(&cl->lock)); + mutex_init(&pcl->lock); + DBG_BUGON(!mutex_trylock(&pcl->lock)); =20 if (ztailpacking) { pcl->obj.index =3D 0; /* which indicates ztailpacking */ @@ -519,11 +512,10 @@ static int z_erofs_register_collection(struct z_erofs= _decompress_frontend *fe, fe->tailpcl =3D pcl; fe->owned_head =3D &pcl->next; fe->pcl =3D pcl; - fe->cl =3D cl; return 0; =20 err_out: - mutex_unlock(&cl->lock); + mutex_unlock(&pcl->lock); z_erofs_free_pcluster(pcl); return err; } @@ -535,9 +527,9 @@ static int z_erofs_collector_begin(struct z_erofs_decom= press_frontend *fe, struct erofs_workgroup *grp; int ret; =20 - DBG_BUGON(fe->cl); + DBG_BUGON(fe->pcl); =20 - /* must be Z_EROFS_PCLUSTER_TAIL or pointed to previous collection */ + /* must be Z_EROFS_PCLUSTER_TAIL or pointed to previous pcluster */ DBG_BUGON(fe->owned_head =3D=3D Z_EROFS_PCLUSTER_NIL); DBG_BUGON(fe->owned_head =3D=3D Z_EROFS_PCLUSTER_TAIL_CLOSED); =20 @@ -554,14 +546,14 @@ static int z_erofs_collector_begin(struct z_erofs_dec= ompress_frontend *fe, fe->pcl =3D container_of(grp, struct z_erofs_pcluster, obj); } else { tailpacking: - ret =3D z_erofs_register_collection(fe, inode, map); + ret =3D z_erofs_register_pcluster(fe, inode, map); if (!ret) goto out; if (ret !=3D -EEXIST) return ret; } =20 - ret =3D z_erofs_lookup_collection(fe, inode, map); + ret =3D z_erofs_lookup_pcluster(fe, inode, map); if (ret) { erofs_workgroup_put(&fe->pcl->obj); return ret; @@ -569,7 +561,7 @@ static int z_erofs_collector_begin(struct z_erofs_decom= press_frontend *fe, =20 out: z_erofs_pagevec_ctor_init(&fe->vector, Z_EROFS_NR_INLINE_PAGEVECS, - fe->cl->pagevec, fe->cl->vcnt); + fe->pcl->pagevec, fe->pcl->vcnt); /* since file-backed online pages are traversed in reverse order */ fe->icpage_ptr =3D fe->pcl->compressed_pages + z_erofs_pclusterpages(fe->pcl); @@ -582,48 +574,36 @@ static int z_erofs_collector_begin(struct z_erofs_dec= ompress_frontend *fe, */ static void z_erofs_rcu_callback(struct rcu_head *head) { - struct z_erofs_collection *const cl =3D - container_of(head, struct z_erofs_collection, rcu); - - z_erofs_free_pcluster(container_of(cl, struct z_erofs_pcluster, - primary_collection)); + z_erofs_free_pcluster(container_of(head, + struct z_erofs_pcluster, rcu)); } =20 void erofs_workgroup_free_rcu(struct erofs_workgroup *grp) { struct z_erofs_pcluster *const pcl =3D container_of(grp, struct z_erofs_pcluster, obj); - struct z_erofs_collection *const cl =3D z_erofs_primarycollection(pcl); =20 - call_rcu(&cl->rcu, z_erofs_rcu_callback); -} - -static void z_erofs_collection_put(struct z_erofs_collection *cl) -{ - struct z_erofs_pcluster *const pcl =3D - container_of(cl, struct z_erofs_pcluster, primary_collection); - - erofs_workgroup_put(&pcl->obj); + call_rcu(&pcl->rcu, z_erofs_rcu_callback); } =20 static bool z_erofs_collector_end(struct z_erofs_decompress_frontend *fe) { - struct z_erofs_collection *cl =3D fe->cl; + struct z_erofs_pcluster *pcl =3D fe->pcl; =20 - if (!cl) + if (!pcl) return false; =20 z_erofs_pagevec_ctor_exit(&fe->vector, false); - mutex_unlock(&cl->lock); + mutex_unlock(&pcl->lock); =20 /* * if all pending pages are added, don't hold its reference * any longer if the pcluster isn't hosted by ourselves. */ if (fe->mode < COLLECT_PRIMARY_FOLLOWED_NOINPLACE) - z_erofs_collection_put(cl); + erofs_workgroup_put(&pcl->obj); =20 - fe->cl =3D NULL; + fe->pcl =3D NULL; return true; } =20 @@ -666,8 +646,8 @@ static int z_erofs_do_read_page(struct z_erofs_decompre= ss_frontend *fe, /* lucky, within the range of the current map_blocks */ if (offset + cur >=3D map->m_la && offset + cur < map->m_la + map->m_llen) { - /* didn't get a valid collection previously (very rare) */ - if (!fe->cl) + /* didn't get a valid pcluster previously (very rare) */ + if (!fe->pcl) goto restart_now; goto hitted; } @@ -766,7 +746,7 @@ static int z_erofs_do_read_page(struct z_erofs_decompre= ss_frontend *fe, /* bump up the number of spiltted parts of a page */ ++spiltted; /* also update nr_pages */ - fe->cl->nr_pages =3D max_t(pgoff_t, fe->cl->nr_pages, index + 1); + fe->pcl->nr_pages =3D max_t(pgoff_t, fe->pcl->nr_pages, index + 1); next_part: /* can be used for verification */ map->m_llen =3D offset + cur - map->m_la; @@ -821,15 +801,13 @@ static int z_erofs_decompress_pcluster(struct super_b= lock *sb, =20 enum z_erofs_page_type page_type; bool overlapped, partial; - struct z_erofs_collection *cl; int err; =20 might_sleep(); - cl =3D z_erofs_primarycollection(pcl); - DBG_BUGON(!READ_ONCE(cl->nr_pages)); + DBG_BUGON(!READ_ONCE(pcl->nr_pages)); =20 - mutex_lock(&cl->lock); - nr_pages =3D cl->nr_pages; + mutex_lock(&pcl->lock); + nr_pages =3D pcl->nr_pages; =20 if (nr_pages <=3D Z_EROFS_VMAP_ONSTACK_PAGES) { pages =3D pages_onstack; @@ -857,9 +835,9 @@ static int z_erofs_decompress_pcluster(struct super_blo= ck *sb, =20 err =3D 0; z_erofs_pagevec_ctor_init(&ctor, Z_EROFS_NR_INLINE_PAGEVECS, - cl->pagevec, 0); + pcl->pagevec, 0); =20 - for (i =3D 0; i < cl->vcnt; ++i) { + for (i =3D 0; i < pcl->vcnt; ++i) { unsigned int pagenr; =20 page =3D z_erofs_pagevec_dequeue(&ctor, &page_type); @@ -945,11 +923,11 @@ static int z_erofs_decompress_pcluster(struct super_b= lock *sb, goto out; =20 llen =3D pcl->length >> Z_EROFS_PCLUSTER_LENGTH_BIT; - if (nr_pages << PAGE_SHIFT >=3D cl->pageofs + llen) { + if (nr_pages << PAGE_SHIFT >=3D pcl->pageofs_out + llen) { outputsize =3D llen; partial =3D !(pcl->length & Z_EROFS_PCLUSTER_FULL_LENGTH); } else { - outputsize =3D (nr_pages << PAGE_SHIFT) - cl->pageofs; + outputsize =3D (nr_pages << PAGE_SHIFT) - pcl->pageofs_out; partial =3D true; } =20 @@ -963,7 +941,7 @@ static int z_erofs_decompress_pcluster(struct super_blo= ck *sb, .in =3D compressed_pages, .out =3D pages, .pageofs_in =3D pcl->pageofs_in, - .pageofs_out =3D cl->pageofs, + .pageofs_out =3D pcl->pageofs_out, .inputsize =3D inputsize, .outputsize =3D outputsize, .alg =3D pcl->algorithmformat, @@ -1012,16 +990,12 @@ static int z_erofs_decompress_pcluster(struct super_= block *sb, else if (pages !=3D pages_onstack) kvfree(pages); =20 - cl->nr_pages =3D 0; - cl->vcnt =3D 0; + pcl->nr_pages =3D 0; + pcl->vcnt =3D 0; =20 - /* all cl locks MUST be taken before the following line */ + /* pcluster lock MUST be taken before the following line */ WRITE_ONCE(pcl->next, Z_EROFS_PCLUSTER_NIL); - - /* all cl locks SHOULD be released right now */ - mutex_unlock(&cl->lock); - - z_erofs_collection_put(cl); + mutex_unlock(&pcl->lock); return err; } =20 @@ -1043,6 +1017,7 @@ static void z_erofs_decompress_queue(const struct z_e= rofs_decompressqueue *io, owned =3D READ_ONCE(pcl->next); =20 z_erofs_decompress_pcluster(io->sb, pcl, pagepool); + erofs_workgroup_put(&pcl->obj); } } =20 diff --git a/fs/erofs/zdata.h b/fs/erofs/zdata.h index 800b11c53f57..58053bb5066f 100644 --- a/fs/erofs/zdata.h +++ b/fs/erofs/zdata.h @@ -12,21 +12,40 @@ #define Z_EROFS_PCLUSTER_MAX_PAGES (Z_EROFS_PCLUSTER_MAX_SIZE / PAGE_SIZE) #define Z_EROFS_NR_INLINE_PAGEVECS 3 =20 +#define Z_EROFS_PCLUSTER_FULL_LENGTH 0x00000001 +#define Z_EROFS_PCLUSTER_LENGTH_BIT 1 + +/* + * let's leave a type here in case of introducing + * another tagged pointer later. + */ +typedef void *z_erofs_next_pcluster_t; + /* * Structure fields follow one of the following exclusion rules. * * I: Modifiable by initialization/destruction paths and read-only * for everyone else; * - * L: Field should be protected by pageset lock; + * L: Field should be protected by the pcluster lock; * * A: Field should be accessed / updated in atomic for parallelized code. */ -struct z_erofs_collection { +struct z_erofs_pcluster { + struct erofs_workgroup obj; struct mutex lock; =20 + /* A: point to next chained pcluster or TAILs */ + z_erofs_next_pcluster_t next; + + /* A: lower limit of decompressed length and if full length or not */ + unsigned int length; + /* I: page offset of start position of decompression */ - unsigned short pageofs; + unsigned short pageofs_out; + + /* I: page offset of inline compressed data */ + unsigned short pageofs_in; =20 /* L: maximum relative page index in pagevec[] */ unsigned short nr_pages; @@ -41,29 +60,6 @@ struct z_erofs_collection { /* I: can be used to free the pcluster by RCU. */ struct rcu_head rcu; }; -}; - -#define Z_EROFS_PCLUSTER_FULL_LENGTH 0x00000001 -#define Z_EROFS_PCLUSTER_LENGTH_BIT 1 - -/* - * let's leave a type here in case of introducing - * another tagged pointer later. - */ -typedef void *z_erofs_next_pcluster_t; - -struct z_erofs_pcluster { - struct erofs_workgroup obj; - struct z_erofs_collection primary_collection; - - /* A: point to next chained pcluster or TAILs */ - z_erofs_next_pcluster_t next; - - /* A: lower limit of decompressed length and if full length or not */ - unsigned int length; - - /* I: page offset of inline compressed data */ - unsigned short pageofs_in; =20 union { /* I: physical cluster size in pages */ @@ -80,8 +76,6 @@ struct z_erofs_pcluster { struct page *compressed_pages[]; }; =20 -#define z_erofs_primarycollection(pcluster) (&(pcluster)->primary_collecti= on) - /* let's avoid the valid 32-bit kernel addresses */ =20 /* the chained workgroup has't submitted io (still open) */ --=20 2.30.2 From nobody Tue May 5 11:31:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55FA3C433EF for ; Sun, 29 May 2022 05:56:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230427AbiE2F42 (ORCPT ); Sun, 29 May 2022 01:56:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230408AbiE2F4U (ORCPT ); Sun, 29 May 2022 01:56:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 458036B0A2 for ; Sat, 28 May 2022 22:56:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D5E5D60DD6 for ; Sun, 29 May 2022 05:56:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D9FCC34119; Sun, 29 May 2022 05:56:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653803778; bh=ILHcOL+VeOJQPjhcWAot4jRYCJb0WUQYJb7FOE03RaI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NEWte+aAbfP1T1fPvnc0T551Ldf4jdMQjn0IxlI/JX9lDizQ+nVHQhs+900J1AnxV clyZb9JohlaRK/lZIWHFoyBZJWddRdY6bU09JYQbB0Orl9D3ApGdCUdGE6DiooH+0l +VHde9X8ixHF3xexJ1XCP9rUNkRJtLgS5uZfLvNbq39FGwz97nIrMNm77qOdmAfI67 HOj/PYJGB2kPLaSO6Pgurm4FJStC+CnlHbiK05AGcZTasizRzp/2tXYVHnMSZc0msc 6FiVC/ZPvjesP2gOJBno1Qv0t9XmCuu2HYGLqGkSkJ//ldMuusg5yL/US+n9AnUdPK p7eHU0e+0WHVQ== From: Gao Xiang To: linux-erofs@lists.ozlabs.org, Chao Yu Cc: linux-kernel@vger.kernel.org, Gao Xiang Subject: [PATCH 2/3] erofs: get rid of label `restart_now' Date: Sun, 29 May 2022 13:54:24 +0800 Message-Id: <20220529055425.226363-3-xiang@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220529055425.226363-1-xiang@kernel.org> References: <20220529055425.226363-1-xiang@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Gao Xiang Simplify this part of code. No logic changes. Signed-off-by: Gao Xiang Acked-by: Chao Yu --- fs/erofs/zdata.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index 4fd66a66c5f9..6dd858f94e44 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -643,28 +643,23 @@ static int z_erofs_do_read_page(struct z_erofs_decomp= ress_frontend *fe, repeat: cur =3D end - 1; =20 - /* lucky, within the range of the current map_blocks */ - if (offset + cur >=3D map->m_la && - offset + cur < map->m_la + map->m_llen) { + if (offset + cur < map->m_la || + offset + cur >=3D map->m_la + map->m_llen) { + erofs_dbg("out-of-range map @ pos %llu", offset + cur); + + if (z_erofs_collector_end(fe)) + fe->backmost =3D false; + map->m_la =3D offset + cur; + map->m_llen =3D 0; + err =3D z_erofs_map_blocks_iter(inode, map, 0); + if (err) + goto err_out; + } else { + if (fe->pcl) + goto hitted; /* didn't get a valid pcluster previously (very rare) */ - if (!fe->pcl) - goto restart_now; - goto hitted; } =20 - /* go ahead the next map_blocks */ - erofs_dbg("%s: [out-of-range] pos %llu", __func__, offset + cur); - - if (z_erofs_collector_end(fe)) - fe->backmost =3D false; - - map->m_la =3D offset + cur; - map->m_llen =3D 0; - err =3D z_erofs_map_blocks_iter(inode, map, 0); - if (err) - goto err_out; - -restart_now: if (!(map->m_flags & EROFS_MAP_MAPPED)) goto hitted; =20 --=20 2.30.2 From nobody Tue May 5 11:31:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04076C433F5 for ; Sun, 29 May 2022 05:57:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230201AbiE2F5U (ORCPT ); Sun, 29 May 2022 01:57:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230423AbiE2F4Y (ORCPT ); Sun, 29 May 2022 01:56:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 069816B0A2 for ; Sat, 28 May 2022 22:56:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9687B60DED for ; Sun, 29 May 2022 05:56:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D742C3411C; Sun, 29 May 2022 05:56:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653803781; bh=IJu+gkphhFylVDsQzhP8KOtGyF6aW9neo4uSaI2lipk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gXUTrQO6ZFLlgIQrh39yuohMijrv1AGoz4cZf4mzpmJgJNKBlnTG1oFJ7gNnRkKGL +Ls9+4ziGmn3YWT+tngfnuZxDnRk9IkOZcDigGgivbo9yRCd7Ea/bFEAW7wwY5XISi DtFlDDC5lJM3B+4R+esdPxurYgqs5L+cnDdjB8d9ztAlbSYALIHgBNW7Fv4FU6Edcf k/tEMelO8S/J0kl19Yq5xMh5xSZ4dJBarecR2BREdvz/4fd9L5YAEo2z2UZ5jDkpGf zZSNozKaVsc72uFiFG+Drn2Vtd0OLKE4ONw0zf1mHuhkqf39awJrEOCnJlwK0oeDm6 3M1jT8Ud4GB9A== From: Gao Xiang To: linux-erofs@lists.ozlabs.org, Chao Yu Cc: linux-kernel@vger.kernel.org, Gao Xiang Subject: [PATCH 3/3] erofs: simplify z_erofs_pcluster_readmore() Date: Sun, 29 May 2022 13:54:25 +0800 Message-Id: <20220529055425.226363-4-xiang@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220529055425.226363-1-xiang@kernel.org> References: <20220529055425.226363-1-xiang@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Gao Xiang Get rid of unnecessary label `skip'. No logic changes. Signed-off-by: Gao Xiang Acked-by: Chao Yu --- fs/erofs/zdata.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index 6dd858f94e44..b33fb64b3393 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -1436,22 +1436,19 @@ static void z_erofs_pcluster_readmore(struct z_erof= s_decompress_frontend *f, struct page *page; =20 page =3D erofs_grab_cache_page_nowait(inode->i_mapping, index); - if (!page) - goto skip; - - if (PageUptodate(page)) { - unlock_page(page); + if (page) { + if (PageUptodate(page)) { + unlock_page(page); + } else { + err =3D z_erofs_do_read_page(f, page, pagepool); + if (err) + erofs_err(inode->i_sb, + "readmore error at page %lu @ nid %llu", + index, EROFS_I(inode)->nid); + } put_page(page); - goto skip; } =20 - err =3D z_erofs_do_read_page(f, page, pagepool); - if (err) - erofs_err(inode->i_sb, - "readmore error at page %lu @ nid %llu", - index, EROFS_I(inode)->nid); - put_page(page); -skip: if (cur < PAGE_SIZE) break; cur =3D (index << PAGE_SHIFT) - 1; --=20 2.30.2