From patchwork Tue Apr 5 12:07:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 8750851 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3CCA6C0553 for ; Tue, 5 Apr 2016 12:11:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5C6952012B for ; Tue, 5 Apr 2016 12:11:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7DA5320117 for ; Tue, 5 Apr 2016 12:11:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932837AbcDEMKp (ORCPT ); Tue, 5 Apr 2016 08:10:45 -0400 Received: from mail-pa0-f66.google.com ([209.85.220.66]:36828 "EHLO mail-pa0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932575AbcDEMKo (ORCPT ); Tue, 5 Apr 2016 08:10:44 -0400 Received: by mail-pa0-f66.google.com with SMTP id 1so1140650pal.3; Tue, 05 Apr 2016 05:10:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NMWunyF5EyyEg+rPkerwokgWesP2VsM6sJTkPNlu5eU=; b=sHGFfqL/VHeCSKqzPWUhdPwRY2pH0kii2llo7X3o0gHvWq0fkoW3fl7xIH9b58DRMY sqstt/w9jyDgynOrXR01cQJvMepNUsqj5x0QJ2sVfD3N8Pd3T+z8x2WJ90OygJF2Cx+j XIUowf6HheBjREAsOc3aKLZQqCcaD8+lZZdCkE1kSx9sMJbyniRz2nBaYEOIwvD7IswH Rrl/m2VBLZ7k4MpC0800D/+JV/EAToy3pAev/clDohXsUdsnMEe7Ug/3ipY2jKVY2k6/ ureqOJOLrxaDampDsHyW1qIbOsBVTsG+e2vxr4I/aFuu/mdY1eEJnE0J0vqnioG23SHQ Ki+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NMWunyF5EyyEg+rPkerwokgWesP2VsM6sJTkPNlu5eU=; b=VqQuvnBam+TwA7/8D7684zgUBHmtGVb5mRbBqs1Xg6apxhyxgLNVx2hRFv0I8pLZPl rEuZfzP+j6MRtzw/03ViFje6ihSuOrohgI6/ag1qBcx18w6T8EQmv39ATZ2IqyMAs8PZ NUwkTzfaCK3G+U0HaJ7Y367865xVaj88B0ydVH8+NIe9fuqBCCwQ4CQQQWaj6W7BRZAG kAfOoZX5LmrIDwcUEFnGb7INJbW5k0x8PwAXj7i7EG/o4dgnuQK1tJP6xh7T5LkLkiZ7 XT7GdKfF2TAEv2/HsMzk7aXGKf/5ZDwvWZQUYXW6ncKdLF08Fd0SMkJEYuIqHL9UV1R3 HhXw== X-Gm-Message-State: AD7BkJLTwcKuCpUQCWoidSZyyVlLdhHrTzJd7gt8JKb2SeRqgWLmxjRhyoq+0YtViX1D6A== X-Received: by 10.66.235.9 with SMTP id ui9mr61688042pac.135.1459858243271; Tue, 05 Apr 2016 05:10:43 -0700 (PDT) Received: from localhost (56.34.213.162.lcy-01.canonistack.canonical.com. [162.213.34.56]) by smtp.gmail.com with ESMTPSA id z68sm46578415pfi.19.2016.04.05.05.10.41 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 05 Apr 2016 05:10:42 -0700 (PDT) From: Ming Lei To: Jens Axboe , linux-kernel@vger.kernel.org Cc: linux-block@vger.kernel.org, Christoph Hellwig , Boaz Harrosh , Ming Lei , Andrew Morton , Dongsu Park , Minchan Kim , Tejun Heo , Joe Perches , Kent Overstreet , Omar Sandoval , linux-mm@kvack.org (open list:MEMORY MANAGEMENT) Subject: [PATCH 27/27] mm: page_io.c: use bio_get_base_vec() Date: Tue, 5 Apr 2016 20:07:42 +0800 Message-Id: <1459858062-21075-13-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1459858062-21075-1-git-send-email-tom.leiming@gmail.com> References: <1459858062-21075-1-git-send-email-tom.leiming@gmail.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 18aac78..b5a6baf 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);