diff options
author | Alex Elder <elder@inktank.com> | 2013-02-25 18:35:46 -0500 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-05-02 00:14:28 -0400 |
commit | d4b515fa10dd52a2aef88df7299e9f3a8ab0957a (patch) | |
tree | 0110566b4e00aeb5215b1b967ff64695cd45eb10 | |
parent | 60cf5992d96dd5b97baf74cd400d6e05f7f2c93e (diff) |
libceph: distinguish page array and pagelist count
Use distinct fields for tracking the number of pages in a message's
page array and in a message's page list. Currently only one or the
other is used at a time, but that will be changing soon.
Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
-rw-r--r-- | fs/ceph/mds_client.c | 4 | ||||
-rw-r--r-- | include/linux/ceph/messenger.h | 3 | ||||
-rw-r--r-- | net/ceph/messenger.c | 14 | ||||
-rw-r--r-- | net/ceph/osd_client.c | 4 |
4 files changed, 14 insertions, 11 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 442880d099c9..5c17705f88b1 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -1719,7 +1719,7 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc, | |||
1719 | msg->hdr.front_len = cpu_to_le32(msg->front.iov_len); | 1719 | msg->hdr.front_len = cpu_to_le32(msg->front.iov_len); |
1720 | 1720 | ||
1721 | msg->pages = req->r_pages; | 1721 | msg->pages = req->r_pages; |
1722 | msg->nr_pages = req->r_num_pages; | 1722 | msg->page_count = req->r_num_pages; |
1723 | msg->hdr.data_len = cpu_to_le32(req->r_data_len); | 1723 | msg->hdr.data_len = cpu_to_le32(req->r_data_len); |
1724 | msg->hdr.data_off = cpu_to_le16(0); | 1724 | msg->hdr.data_off = cpu_to_le16(0); |
1725 | 1725 | ||
@@ -2600,10 +2600,10 @@ static void send_mds_reconnect(struct ceph_mds_client *mdsc, | |||
2600 | } | 2600 | } |
2601 | 2601 | ||
2602 | reply->pagelist = pagelist; | 2602 | reply->pagelist = pagelist; |
2603 | reply->pagelist_count = calc_pages_for(0, pagelist->length); | ||
2603 | if (recon_state.flock) | 2604 | if (recon_state.flock) |
2604 | reply->hdr.version = cpu_to_le16(2); | 2605 | reply->hdr.version = cpu_to_le16(2); |
2605 | reply->hdr.data_len = cpu_to_le32(pagelist->length); | 2606 | reply->hdr.data_len = cpu_to_le32(pagelist->length); |
2606 | reply->nr_pages = calc_pages_for(0, pagelist->length); | ||
2607 | ceph_con_send(&session->s_con, reply); | 2607 | ceph_con_send(&session->s_con, reply); |
2608 | 2608 | ||
2609 | mutex_unlock(&session->s_mutex); | 2609 | mutex_unlock(&session->s_mutex); |
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h index 8297288a66e0..1b08349a413c 100644 --- a/include/linux/ceph/messenger.h +++ b/include/linux/ceph/messenger.h | |||
@@ -75,9 +75,10 @@ struct ceph_msg { | |||
75 | struct kvec front; /* unaligned blobs of message */ | 75 | struct kvec front; /* unaligned blobs of message */ |
76 | struct ceph_buffer *middle; | 76 | struct ceph_buffer *middle; |
77 | struct page **pages; /* data payload. NOT OWNER. */ | 77 | struct page **pages; /* data payload. NOT OWNER. */ |
78 | unsigned nr_pages; /* size of page array */ | 78 | unsigned page_count; /* size of page array */ |
79 | unsigned page_alignment; /* io offset in first page */ | 79 | unsigned page_alignment; /* io offset in first page */ |
80 | struct ceph_pagelist *pagelist; /* instead of pages */ | 80 | struct ceph_pagelist *pagelist; /* instead of pages */ |
81 | unsigned int pagelist_count; /* number of pages in pagelist */ | ||
81 | 82 | ||
82 | struct ceph_connection *con; | 83 | struct ceph_connection *con; |
83 | struct list_head list_head; | 84 | struct list_head list_head; |
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index c06f94009d73..9d8abb0a7cef 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -813,7 +813,7 @@ static void prepare_write_message(struct ceph_connection *con) | |||
813 | m, con->out_seq, le16_to_cpu(m->hdr.type), | 813 | m, con->out_seq, le16_to_cpu(m->hdr.type), |
814 | le32_to_cpu(m->hdr.front_len), le32_to_cpu(m->hdr.middle_len), | 814 | le32_to_cpu(m->hdr.front_len), le32_to_cpu(m->hdr.middle_len), |
815 | le32_to_cpu(m->hdr.data_len), | 815 | le32_to_cpu(m->hdr.data_len), |
816 | m->nr_pages); | 816 | m->page_count); |
817 | BUG_ON(le32_to_cpu(m->hdr.front_len) != m->front.iov_len); | 817 | BUG_ON(le32_to_cpu(m->hdr.front_len) != m->front.iov_len); |
818 | 818 | ||
819 | /* tag + hdr + front + middle */ | 819 | /* tag + hdr + front + middle */ |
@@ -1072,7 +1072,7 @@ static int write_partial_msg_pages(struct ceph_connection *con) | |||
1072 | const size_t trail_off = data_len - trail_len; | 1072 | const size_t trail_off = data_len - trail_len; |
1073 | 1073 | ||
1074 | dout("write_partial_msg_pages %p msg %p page %d/%d offset %d\n", | 1074 | dout("write_partial_msg_pages %p msg %p page %d/%d offset %d\n", |
1075 | con, msg, con->out_msg_pos.page, msg->nr_pages, | 1075 | con, msg, con->out_msg_pos.page, msg->page_count, |
1076 | con->out_msg_pos.page_pos); | 1076 | con->out_msg_pos.page_pos); |
1077 | 1077 | ||
1078 | /* | 1078 | /* |
@@ -2715,9 +2715,10 @@ struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags, | |||
2715 | m->middle = NULL; | 2715 | m->middle = NULL; |
2716 | 2716 | ||
2717 | /* data */ | 2717 | /* data */ |
2718 | m->nr_pages = 0; | 2718 | m->page_count = 0; |
2719 | m->page_alignment = 0; | 2719 | m->page_alignment = 0; |
2720 | m->pages = NULL; | 2720 | m->pages = NULL; |
2721 | m->pagelist_count = 0; | ||
2721 | m->pagelist = NULL; | 2722 | m->pagelist = NULL; |
2722 | #ifdef CONFIG_BLOCK | 2723 | #ifdef CONFIG_BLOCK |
2723 | m->bio = NULL; | 2724 | m->bio = NULL; |
@@ -2890,13 +2891,14 @@ void ceph_msg_last_put(struct kref *kref) | |||
2890 | ceph_buffer_put(m->middle); | 2891 | ceph_buffer_put(m->middle); |
2891 | m->middle = NULL; | 2892 | m->middle = NULL; |
2892 | } | 2893 | } |
2893 | m->nr_pages = 0; | 2894 | m->page_count = 0; |
2894 | m->pages = NULL; | 2895 | m->pages = NULL; |
2895 | 2896 | ||
2896 | if (m->pagelist) { | 2897 | if (m->pagelist) { |
2897 | ceph_pagelist_release(m->pagelist); | 2898 | ceph_pagelist_release(m->pagelist); |
2898 | kfree(m->pagelist); | 2899 | kfree(m->pagelist); |
2899 | m->pagelist = NULL; | 2900 | m->pagelist = NULL; |
2901 | m->pagelist_count = 0; | ||
2900 | } | 2902 | } |
2901 | 2903 | ||
2902 | m->trail = NULL; | 2904 | m->trail = NULL; |
@@ -2910,8 +2912,8 @@ EXPORT_SYMBOL(ceph_msg_last_put); | |||
2910 | 2912 | ||
2911 | void ceph_msg_dump(struct ceph_msg *msg) | 2913 | void ceph_msg_dump(struct ceph_msg *msg) |
2912 | { | 2914 | { |
2913 | pr_debug("msg_dump %p (front_max %d nr_pages %d)\n", msg, | 2915 | pr_debug("msg_dump %p (front_max %d page_count %d)\n", msg, |
2914 | msg->front_max, msg->nr_pages); | 2916 | msg->front_max, msg->page_count); |
2915 | print_hex_dump(KERN_DEBUG, "header: ", | 2917 | print_hex_dump(KERN_DEBUG, "header: ", |
2916 | DUMP_PREFIX_OFFSET, 16, 1, | 2918 | DUMP_PREFIX_OFFSET, 16, 1, |
2917 | &msg->hdr, sizeof(msg->hdr), true); | 2919 | &msg->hdr, sizeof(msg->hdr), true); |
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 29e4fe09e31a..c3d8c6904df3 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -1742,7 +1742,7 @@ int ceph_osdc_start_request(struct ceph_osd_client *osdc, | |||
1742 | int rc = 0; | 1742 | int rc = 0; |
1743 | 1743 | ||
1744 | req->r_request->pages = req->r_pages; | 1744 | req->r_request->pages = req->r_pages; |
1745 | req->r_request->nr_pages = req->r_num_pages; | 1745 | req->r_request->page_count = req->r_num_pages; |
1746 | #ifdef CONFIG_BLOCK | 1746 | #ifdef CONFIG_BLOCK |
1747 | req->r_request->bio = req->r_bio; | 1747 | req->r_request->bio = req->r_bio; |
1748 | #endif | 1748 | #endif |
@@ -2093,7 +2093,7 @@ static struct ceph_msg *get_reply(struct ceph_connection *con, | |||
2093 | goto out; | 2093 | goto out; |
2094 | } | 2094 | } |
2095 | m->pages = req->r_pages; | 2095 | m->pages = req->r_pages; |
2096 | m->nr_pages = req->r_num_pages; | 2096 | m->page_count = req->r_num_pages; |
2097 | m->page_alignment = req->r_page_alignment; | 2097 | m->page_alignment = req->r_page_alignment; |
2098 | #ifdef CONFIG_BLOCK | 2098 | #ifdef CONFIG_BLOCK |
2099 | m->bio = req->r_bio; | 2099 | m->bio = req->r_bio; |