Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752801AbdHHIvm (ORCPT ); Tue, 8 Aug 2017 04:51:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49882 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752183AbdHHIvj (ORCPT ); Tue, 8 Aug 2017 04:51:39 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 48D9880474 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=ming.lei@redhat.com From: Ming Lei To: Jens Axboe , Christoph Hellwig , Huang Ying , Andrew Morton , Alexander Viro Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Ming Lei Subject: [PATCH v3 28/49] block: introduce bvec_get_last_page() Date: Tue, 8 Aug 2017 16:45:27 +0800 Message-Id: <20170808084548.18963-29-ming.lei@redhat.com> In-Reply-To: <20170808084548.18963-1-ming.lei@redhat.com> References: <20170808084548.18963-1-ming.lei@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 08 Aug 2017 08:51:39 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 919 Lines: 33 BTRFS and guard_bio_eod() need to get the last page, so introduce this helper to make them happy. Signed-off-by: Ming Lei --- include/linux/bvec.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/linux/bvec.h b/include/linux/bvec.h index 23d3abdf057c..ceb6292750d6 100644 --- a/include/linux/bvec.h +++ b/include/linux/bvec.h @@ -238,4 +238,18 @@ static inline bool bvec_iter_advance_mp(const struct bio_vec *bv, #define bvec_for_each_sp_bvec(sp_bvl, mp_bvec, iter) \ __bvec_for_each_sp_bvec(sp_bvl, mp_bvec, iter, BVEC_ITER_ALL_INIT) +/* + * get the last page from the multipage bvec and store it + * in @sp_bv + */ +static inline void bvec_get_last_page(struct bio_vec *mp_bv, + struct bio_vec *sp_bv) +{ + struct bvec_iter iter; + + *sp_bv = *mp_bv; + bvec_for_each_sp_bvec(*sp_bv, mp_bv, iter) + ; +} + #endif /* __LINUX_BVEC_ITER_H */ -- 2.9.4