Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755175AbcDNMD5 (ORCPT ); Thu, 14 Apr 2016 08:03:57 -0400 Received: from mail-oi0-f66.google.com ([209.85.218.66]:33434 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755076AbcDNMDv (ORCPT ); Thu, 14 Apr 2016 08:03:51 -0400 From: Ming Lei To: Jens Axboe , linux-kernel@vger.kernel.org Cc: linux-block@vger.kernel.org, Christoph Hellwig , Ming Lei , Andrew Morton , Dongsu Park , "Rafael J. Wysocki" , Kent Overstreet , "Kirill A. Shutemov" , Joe Perches , Minchan Kim , linux-mm@kvack.org (open list:MEMORY MANAGEMENT) Subject: [PATCH v1 27/27] mm: page_io.c: use bio_get_base_vec() Date: Thu, 14 Apr 2016 20:02:45 +0800 Message-Id: <1460635375-28282-28-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1460635375-28282-1-git-send-email-tom.leiming@gmail.com> References: <1460635375-28282-1-git-send-email-tom.leiming@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1128 Lines: 43 Signed-off-by: Ming Lei --- mm/page_io.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index cd92e3d..1ced9d3 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -43,7 +43,14 @@ static struct bio *get_swap_bio(gfp_t gfp_flags, void end_swap_bio_write(struct bio *bio) { - struct page *page = bio->bi_io_vec[0].bv_page; + /* + * Single bvec bio. + * + * For accessing page pointed to by the 1st bvec, it + * works too after multipage bvecs. + */ + struct bio_vec *bvec = bio_get_base_vec(bio); + struct page *page = bvec->bv_page; if (bio->bi_error) { SetPageError(page); @@ -116,7 +123,14 @@ static void swap_slot_free_notify(struct page *page) static void end_swap_bio_read(struct bio *bio) { - struct page *page = bio->bi_io_vec[0].bv_page; + /* + * Single bvec bio. + * + * For accessing page pointed to by the 1st bvec, it + * works too after multipage bvecs. + */ + struct bio_vec *bvec = bio_get_base_vec(bio); + struct page *page = bvec->bv_page; if (bio->bi_error) { SetPageError(page); -- 1.9.1