From patchwork Fri Jan 6 17:40:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13091660 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 962A4C3DA7A for ; Fri, 6 Jan 2023 17:40:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232849AbjAFRkd (ORCPT ); Fri, 6 Jan 2023 12:40:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230497AbjAFRkc (ORCPT ); Fri, 6 Jan 2023 12:40:32 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9ABD7D9DC; Fri, 6 Jan 2023 09:40:31 -0800 (PST) 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 4CA4F616F5; Fri, 6 Jan 2023 17:40:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAC3CC433EF; Fri, 6 Jan 2023 17:40:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673026830; bh=RPl7e2yBo83c5bpefsyB/x5AStixSmvwCt6OqN8mVRA=; h=From:To:Cc:Subject:Date:From; b=NXZXYzIz+4ecrSUefmPBaOBbALJel/O/I56Yx+vNVLtvvGtgf94GV1QFNHD6OR3I6 i0GyyTkuKlVocoLBOqq50sdu/aj0RGLCZQQGq0eeDZOgBS1WJbFl7nB+/Alqr6eRfC uvUP/EUfkOQjMyV2e31sJWCdpo13LLjLtdfx//WtynQZE6FL68aYh45dJwALkyPfqj B9vGPTfQVeZUQMdGN8tiOq2V5qDa3+AeBncTri0dCoSdXqRp9Tmyhp9/xGMkWGvohs gQlzaWNk2/L8YwsNRRwssuwjPlp5u8iFDA/rLIvSqqbbIFZSLKTLYdUBFs/ixfvZSt d9h5NGQ00D4xg== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , willy@infradead.org, Xiubo Li , Ilya Dryomov , Jeff Layton , linux-mm@kvack.org, ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/3] add folio_headpage() macro Date: Fri, 6 Jan 2023 17:40:25 +0000 Message-Id: <20230106174028.151384-1-sj@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org The standard idiom for getting head page of a given folio is '&folio->page'. It is efficient and safe even if the folio is NULL, because the offset of page field in folio is zero. However, it makes the code not that easy to understand at the first glance, especially the NULL safety. Also, sometimes people forget the idiom and use 'folio_page(folio, 0)' instead. To make it easier to read and remember, add a new macro function called 'folio_headpage()' with the NULL case explanation. Then, replace the 'folio_page(folio, 0)' calls with 'folio_headpage(folio)'. SeongJae Park (3): include/linux/page-flags: add folio_headpage() mm: use folio_headpage() instead of folio_page() fs/ceph/addr: use folio_headpage() instead of folio_page() fs/ceph/addr.c | 2 +- include/linux/page-flags.h | 8 ++++++++ mm/shmem.c | 4 ++-- mm/slab.c | 6 +++--- mm/slab_common.c | 4 ++-- mm/slub.c | 4 ++-- 6 files changed, 18 insertions(+), 10 deletions(-)