Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5615671ybp; Tue, 8 Oct 2019 05:54:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqyUr+Wb+VIh7Y+JJLR8a21suZQqNxVaKjkrEzNVXN8oN1xKGTcrFvP9qjS76+gWf3gfxL2E X-Received: by 2002:a17:906:4b15:: with SMTP id y21mr28645859eju.112.1570539246515; Tue, 08 Oct 2019 05:54:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570539246; cv=none; d=google.com; s=arc-20160816; b=S2rpTFzg/KFPAmqjwkr0XAczRcdfphg45AWMLgVjbfDDbp3Hir5lLqV76IzQ/pLxH/ 9saukoRfQXqg0JFpR7VAmTj1+LAnngSEgw5EH64kgflchq4YjwwJs4foGKHVQCtkzgK+ BRk3Q9JRiKVnDSYpGd/3yScbn6NRQ28vRZm/2SHpuvV5R6VyVfjDhaNXXZGHBIeIAQFE 2xDqDroRAbpWxMSdZTBHPLkHwGisF6cHQegF0bLlTyHTUb8ko0lIwrs+MWIbxzDdPltf Km6eJanExhWDSy5IJu+tr060VdIQWgB8NzV4HWTA1BumIuuRl68BIr9TYkI2rUPBsUwT HLgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=5Xu00sYM5ZjGtwouRVVGk5YspybBuLHBlXa20duP3VY=; b=HiSmOnHed6GIGTZ7Rb/477QH369Mnwtp1JXB2bHcnAJCtQeQNIWnnqkVoAaZoQOOC9 tTO2l0laUq6n7WCRIK39LRxrp+oKNPotAbjMH6UbUprsPUiLQDe8QFAb40t6ivm1PSN5 /ywFse10cyNzSKfVHvQnzLIwzlEIuQVnfVDvUuqmM58Yi2NHoQF3an3E773VwuqTMhfm Ay6rmJ61OhWKbB+fxjBijA8fArmJEwNX/uefTTaTUI2KR2qeCHG3KKxc80wCrojHlieK r/00I6K0059WxanIqcCFoF4VSgAdYqonJM7c0qG3OFAUKsF0fIPmSf4SeVBLr+OBPQtp KxRg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l18si10132300edb.155.2019.10.08.05.53.43; Tue, 08 Oct 2019 05:54:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731088AbfJHMxX (ORCPT + 99 others); Tue, 8 Oct 2019 08:53:23 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:36936 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730301AbfJHMxX (ORCPT ); Tue, 8 Oct 2019 08:53:23 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id EE0A8341A32B5758DA77; Tue, 8 Oct 2019 20:53:20 +0800 (CST) Received: from architecture4.huawei.com (10.140.130.215) by smtp.huawei.com (10.3.19.202) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 8 Oct 2019 20:53:14 +0800 From: Gao Xiang To: Chao Yu , CC: LKML , Miao Xie , "Li Guifu" , Gao Xiang Subject: [PATCH for-next 3/5] erofs: get rid of __stagingpage_alloc helper Date: Tue, 8 Oct 2019 20:56:14 +0800 Message-ID: <20191008125616.183715-3-gaoxiang25@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191008125616.183715-1-gaoxiang25@huawei.com> References: <20191008125616.183715-1-gaoxiang25@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.140.130.215] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now open code is much cleaner due to iterative development. Signed-off-by: Gao Xiang --- fs/erofs/zdata.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index 93f8bc1a64f6..e2a89aa921b1 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -546,15 +546,6 @@ static bool z_erofs_collector_end(struct z_erofs_collector *clt) return true; } -static inline struct page *__stagingpage_alloc(struct list_head *pagepool, - gfp_t gfp) -{ - struct page *page = erofs_allocpage(pagepool, gfp, true); - - page->mapping = Z_EROFS_MAPPING_STAGING; - return page; -} - static bool should_alloc_managed_pages(struct z_erofs_decompress_frontend *fe, unsigned int cachestrategy, erofs_off_t la) @@ -661,8 +652,9 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe, /* should allocate an additional staging page for pagevec */ if (err == -EAGAIN) { struct page *const newpage = - __stagingpage_alloc(pagepool, GFP_NOFS); + erofs_allocpage(pagepool, GFP_NOFS, true); + newpage->mapping = Z_EROFS_MAPPING_STAGING; err = z_erofs_attach_page(clt, newpage, Z_EROFS_PAGE_TYPE_EXCLUSIVE); if (!err) @@ -1079,15 +1071,14 @@ static struct page *pickup_page_for_submission(struct z_erofs_pcluster *pcl, unlock_page(page); put_page(page); out_allocpage: - page = __stagingpage_alloc(pagepool, gfp); + page = erofs_allocpage(pagepool, gfp, true); if (oldpage != cmpxchg(&pcl->compressed_pages[nr], oldpage, page)) { list_add(&page->lru, pagepool); cpu_relax(); goto repeat; } - if (!tocache) - goto out; - if (add_to_page_cache_lru(page, mc, index + nr, gfp)) { + + if (!tocache || add_to_page_cache_lru(page, mc, index + nr, gfp)) { page->mapping = Z_EROFS_MAPPING_STAGING; goto out; } -- 2.17.1