From patchwork Mon Feb 25 22:40:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2182951 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 277903FCA4 for ; Mon, 25 Feb 2013 22:40:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932312Ab3BYWkf (ORCPT ); Mon, 25 Feb 2013 17:40:35 -0500 Received: from mail-ia0-f182.google.com ([209.85.210.182]:47436 "EHLO mail-ia0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932228Ab3BYWkf (ORCPT ); Mon, 25 Feb 2013 17:40:35 -0500 Received: by mail-ia0-f182.google.com with SMTP id k38so2904835iah.41 for ; Mon, 25 Feb 2013 14:40:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding:x-gm-message-state; bh=/w0yV01r1KcF//XGK6s90qgIbze5d4vkiq94WpJS3DU=; b=c+cMbz55fYnbQQAIdwIuNVJCVGJp2zeaf7+T7O4xQZdFp9+fjEG/66set7HhxFawts 7l9nDZc+0vTCtRyU7MttfG0deGW5KymIdJMHhNu/VHcjxiNO2kBHXDYkRICpw1zU6Chb gARwdb40p3fUrwLHZ5wvfd2O4OCxDlhLHfDP+f04n/vxuIwDLRat9/12s+IIoerIVzGY ut3LBPSn82pAwlKLhxk0SfNv6qWDfVlcnNulgds034ZUNN1fSrTiajQlp2U8u4c2X/At PkGsAC4W/qECi3hFabHvxrAlGmay3R1cURMxbuc59F61Ot6ry2gbotldB85EnTL420JD ziBg== X-Received: by 10.43.103.195 with SMTP id dj3mr5205820icc.3.1361832034320; Mon, 25 Feb 2013 14:40:34 -0800 (PST) Received: from [172.22.22.4] (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPS id ww6sm4629429igb.2.2013.02.25.14.40.32 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Feb 2013 14:40:33 -0800 (PST) Message-ID: <512BE85F.5090502@inktank.com> Date: Mon, 25 Feb 2013 16:40:31 -0600 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: "ceph-devel@vger.kernel.org" Subject: [PATCH] libceph: make ceph_msg->bio_seg be unsigned X-Gm-Message-State: ALoCoQkz8tKywKpT4UjaOztPNpVQb9GfH9VB7MtF6oelJTQ0h5kXkmf2x/tC2h1//tP042YGu3Sr Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org The bio_seg field is used by the ceph messenger in iterating through a bio. It should never have a negative value, so make it an unsigned. Change variables used to hold bio_seg values to all be unsigned as well. Change two variable names in init_bio_iter() to match the convention used everywhere else. Signed-off-by: Alex Elder Reviewed-by: Josh Durgin --- include/linux/ceph/messenger.h | 2 +- net/ceph/messenger.c | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) return; @@ -1818,7 +1819,8 @@ static int read_partial_message_pages(struct ceph_connection *con, #ifdef CONFIG_BLOCK static int read_partial_message_bio(struct ceph_connection *con, - struct bio **bio_iter, int *bio_seg, + struct bio **bio_iter, + unsigned int *bio_seg, unsigned int data_len, bool do_datacrc) { struct bio_vec *bv = bio_iovec_idx(*bio_iter, *bio_seg); diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h index 60903e0..8297288 100644 --- a/include/linux/ceph/messenger.h +++ b/include/linux/ceph/messenger.h @@ -86,7 +86,7 @@ struct ceph_msg { #ifdef CONFIG_BLOCK struct bio *bio; /* instead of pages/pagelist */ struct bio *bio_iter; /* bio iterator */ - int bio_seg; /* current bio segment */ + unsigned int bio_seg; /* current bio segment */ #endif /* CONFIG_BLOCK */ struct ceph_pagelist *trail; /* the trailing part of the data */ bool front_is_vmalloc; diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 2c0669f..c06f940 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -697,18 +697,19 @@ static void con_out_kvec_add(struct ceph_connection *con, } #ifdef CONFIG_BLOCK -static void init_bio_iter(struct bio *bio, struct bio **iter, int *seg) +static void init_bio_iter(struct bio *bio, struct bio **bio_iter, + unsigned int *bio_seg) { if (!bio) { - *iter = NULL; - *seg = 0; + *bio_iter = NULL; + *bio_seg = 0; return; } - *iter = bio; - *seg = bio->bi_idx; + *bio_iter = bio; + *bio_seg = (unsigned int) bio->bi_idx; } -static void iter_bio_next(struct bio **bio_iter, int *seg) +static void iter_bio_next(struct bio **bio_iter, unsigned int *seg) { if (*bio_iter == NULL)