Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933277AbcDEMKh (ORCPT ); Tue, 5 Apr 2016 08:10:37 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:33578 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932575AbcDEMKc (ORCPT ); Tue, 5 Apr 2016 08:10:32 -0400 From: Ming Lei To: Jens Axboe , linux-kernel@vger.kernel.org Cc: linux-block@vger.kernel.org, Christoph Hellwig , Boaz Harrosh , Ming Lei , "Rafael J. Wysocki" , Len Brown , Pavel Machek , linux-pm@vger.kernel.org (open list:SUSPEND TO RAM) Subject: [PATCH 26/27] kernel/power/swap.c: use bio_get_base_vec() Date: Tue, 5 Apr 2016 20:07:41 +0800 Message-Id: <1459858062-21075-12-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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 805 Lines: 28 Signed-off-by: Ming Lei --- kernel/power/swap.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/kernel/power/swap.c b/kernel/power/swap.c index 12cd989..cedf752 100644 --- a/kernel/power/swap.c +++ b/kernel/power/swap.c @@ -230,7 +230,15 @@ static void hib_init_batch(struct hib_bio_batch *hb) static void hib_end_io(struct bio *bio) { struct hib_bio_batch *hb = bio->bi_private; - 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) { printk(KERN_ALERT "Read-error on swap-device (%u:%u:%Lu)\n", -- 1.9.1