diff options
author | Alex Elder <elder@inktank.com> | 2013-02-15 23:10:17 -0500 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-05-02 00:14:23 -0400 |
commit | 07c09b725543ff2958c11522d583f90f7fdba735 (patch) | |
tree | e59ccdb0798fb56c4d2d34bbe1952b1de9cfdf6c | |
parent | 3ff5f385b1449a07372d51fb89ca94dbfb6a3be2 (diff) |
libceph: make ceph_msg->bio_seg be unsigned
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. (I contemplated making it unsigned short to match the
struct bio definition, but it offered no benefit.)
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 <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
-rw-r--r-- | include/linux/ceph/messenger.h | 2 | ||||
-rw-r--r-- | net/ceph/messenger.c | 16 |
2 files changed, 10 insertions, 8 deletions
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h index 60903e0f665c..8297288a66e0 100644 --- a/include/linux/ceph/messenger.h +++ b/include/linux/ceph/messenger.h | |||
@@ -86,7 +86,7 @@ struct ceph_msg { | |||
86 | #ifdef CONFIG_BLOCK | 86 | #ifdef CONFIG_BLOCK |
87 | struct bio *bio; /* instead of pages/pagelist */ | 87 | struct bio *bio; /* instead of pages/pagelist */ |
88 | struct bio *bio_iter; /* bio iterator */ | 88 | struct bio *bio_iter; /* bio iterator */ |
89 | int bio_seg; /* current bio segment */ | 89 | unsigned int bio_seg; /* current bio segment */ |
90 | #endif /* CONFIG_BLOCK */ | 90 | #endif /* CONFIG_BLOCK */ |
91 | struct ceph_pagelist *trail; /* the trailing part of the data */ | 91 | struct ceph_pagelist *trail; /* the trailing part of the data */ |
92 | bool front_is_vmalloc; | 92 | bool front_is_vmalloc; |
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 2c0669fb54e3..c06f94009d73 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, | |||
697 | } | 697 | } |
698 | 698 | ||
699 | #ifdef CONFIG_BLOCK | 699 | #ifdef CONFIG_BLOCK |
700 | static void init_bio_iter(struct bio *bio, struct bio **iter, int *seg) | 700 | static void init_bio_iter(struct bio *bio, struct bio **bio_iter, |
701 | unsigned int *bio_seg) | ||
701 | { | 702 | { |
702 | if (!bio) { | 703 | if (!bio) { |
703 | *iter = NULL; | 704 | *bio_iter = NULL; |
704 | *seg = 0; | 705 | *bio_seg = 0; |
705 | return; | 706 | return; |
706 | } | 707 | } |
707 | *iter = bio; | 708 | *bio_iter = bio; |
708 | *seg = bio->bi_idx; | 709 | *bio_seg = (unsigned int) bio->bi_idx; |
709 | } | 710 | } |
710 | 711 | ||
711 | static void iter_bio_next(struct bio **bio_iter, int *seg) | 712 | static void iter_bio_next(struct bio **bio_iter, unsigned int *seg) |
712 | { | 713 | { |
713 | if (*bio_iter == NULL) | 714 | if (*bio_iter == NULL) |
714 | return; | 715 | return; |
@@ -1818,7 +1819,8 @@ static int read_partial_message_pages(struct ceph_connection *con, | |||
1818 | 1819 | ||
1819 | #ifdef CONFIG_BLOCK | 1820 | #ifdef CONFIG_BLOCK |
1820 | static int read_partial_message_bio(struct ceph_connection *con, | 1821 | static int read_partial_message_bio(struct ceph_connection *con, |
1821 | struct bio **bio_iter, int *bio_seg, | 1822 | struct bio **bio_iter, |
1823 | unsigned int *bio_seg, | ||
1822 | unsigned int data_len, bool do_datacrc) | 1824 | unsigned int data_len, bool do_datacrc) |
1823 | { | 1825 | { |
1824 | struct bio_vec *bv = bio_iovec_idx(*bio_iter, *bio_seg); | 1826 | struct bio_vec *bv = bio_iovec_idx(*bio_iter, *bio_seg); |