From patchwork Wed Apr 4 19:17:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jerome Glisse X-Patchwork-Id: 10323273 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9731560390 for ; Wed, 4 Apr 2018 19:30:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88C1027CEE for ; Wed, 4 Apr 2018 19:30:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D7D828F56; Wed, 4 Apr 2018 19:30:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3972227CEE for ; Wed, 4 Apr 2018 19:30:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751588AbeDDTaN (ORCPT ); Wed, 4 Apr 2018 15:30:13 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49668 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751231AbeDDTTE (ORCPT ); Wed, 4 Apr 2018 15:19:04 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1F00D4068031; Wed, 4 Apr 2018 19:19:03 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-125-89.rdu2.redhat.com [10.10.125.89]) by smtp.corp.redhat.com (Postfix) with ESMTP id 63E8F8443C; Wed, 4 Apr 2018 19:19:02 +0000 (UTC) From: jglisse@redhat.com To: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org Cc: linux-kernel@vger.kernel.org, =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , Andrew Morton , Alexander Viro , Tejun Heo , Jan Kara , Josef Bacik , Mel Gorman Subject: [RFC PATCH 08/79] mm/page: add helpers to find page mapping and private given a bio Date: Wed, 4 Apr 2018 15:17:55 -0400 Message-Id: <20180404191831.5378-6-jglisse@redhat.com> In-Reply-To: <20180404191831.5378-1-jglisse@redhat.com> References: <20180404191831.5378-1-jglisse@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 04 Apr 2018 19:19:03 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 04 Apr 2018 19:19:03 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jglisse@redhat.com' RCPT:'' Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jérôme Glisse When page undergo io it is associated with a unique bio and thus we can use it to lookup other page fields which are relevant only for the bio under consideration. Note this only apply when page is special ie page->mapping is pointing to some special structure which is not a valid struct address_space. Signed-off-by: Jérôme Glisse Cc: linux-mm@kvack.org CC: Andrew Morton Cc: Alexander Viro Cc: linux-fsdevel@vger.kernel.org Cc: Tejun Heo Cc: Jan Kara Cc: Josef Bacik Cc: Mel Gorman --- include/linux/mm-page.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/linux/mm-page.h b/include/linux/mm-page.h index 647a8a8cf9ba..6ec3ba19b1a4 100644 --- a/include/linux/mm-page.h +++ b/include/linux/mm-page.h @@ -24,6 +24,7 @@ /* External struct dependencies: */ struct address_space; +struct bio; /* External function dependencies: */ extern pgoff_t __page_file_index(struct page *page); @@ -144,5 +145,13 @@ static inline struct address_space *fs_page_mapping_get_with_bh( return page_mapping(page); } +static inline void bio_page_mapping_and_private(struct page *page, + struct bio *bio, struct address_space **mappingp, + unsigned long *privatep) +{ + *mappingp = page->mapping; + *privatep = page_private(page); +} + #endif /* MM_PAGE_H */ #endif /* DOT_NOT_INCLUDE___INSIDE_MM */