Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755348AbcDNMKS (ORCPT ); Thu, 14 Apr 2016 08:10:18 -0400 Received: from mail-ob0-f194.google.com ([209.85.214.194]:33220 "EHLO mail-ob0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754913AbcDNMDc (ORCPT ); Thu, 14 Apr 2016 08:03:32 -0400 From: Ming Lei To: Jens Axboe , linux-kernel@vger.kernel.org Cc: linux-block@vger.kernel.org, Christoph Hellwig , Ming Lei , Oleg Drokin , Andreas Dilger , Greg Kroah-Hartman , Frank Zago , "John L. Hammond" , Mike Rapoport , James Simmons , "Kirill A. Shutemov" , Kent Overstreet , Julia Lawall , lustre-devel@lists.lustre.org (moderated list:STAGING - LUSTRE PARALLEL FILESYSTEM), devel@driverdev.osuosl.org (open list:STAGING SUBSYSTEM) Subject: [PATCH v1 08/27] staging: lustre: avoid to use bio->bi_vcnt directly Date: Thu, 14 Apr 2016 20:02:26 +0800 Message-Id: <1460635375-28282-9-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: 1290 Lines: 37 Acked-by: Greg Kroah-Hartman Signed-off-by: Ming Lei --- drivers/staging/lustre/lustre/llite/lloop.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c index f169c0d..c7bdc2f 100644 --- a/drivers/staging/lustre/lustre/llite/lloop.c +++ b/drivers/staging/lustre/lustre/llite/lloop.c @@ -302,19 +302,20 @@ static unsigned int loop_get_bio(struct lloop_device *lo, struct bio **req) } /* TODO: need to split the bio, too bad. */ - LASSERT(first->bi_vcnt <= LLOOP_MAX_SEGMENTS); + LASSERT(bio_pages(first) <= LLOOP_MAX_SEGMENTS); rw = first->bi_rw; bio = &lo->lo_bio; while (*bio && (*bio)->bi_rw == rw) { + unsigned curr_cnt = bio_pages(*bio); CDEBUG(D_INFO, "bio sector %llu size %u count %u vcnt%u\n", (unsigned long long)(*bio)->bi_iter.bi_sector, (*bio)->bi_iter.bi_size, - page_count, (*bio)->bi_vcnt); - if (page_count + (*bio)->bi_vcnt > LLOOP_MAX_SEGMENTS) + page_count, curr_cnt); + if (page_count + curr_cnt > LLOOP_MAX_SEGMENTS) break; - page_count += (*bio)->bi_vcnt; + page_count += curr_cnt; count++; bio = &(*bio)->bi_next; } -- 1.9.1