aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ceph/mds_client.c4
-rw-r--r--include/linux/ceph/messenger.h22
-rw-r--r--net/ceph/messenger.c11
-rw-r--r--net/ceph/osd_client.c10
4 files changed, 30 insertions, 17 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index ecfb738bca30..90198a407023 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -1721,8 +1721,8 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc,
1721 msg->front.iov_len = p - msg->front.iov_base; 1721 msg->front.iov_len = p - msg->front.iov_base;
1722 msg->hdr.front_len = cpu_to_le32(msg->front.iov_len); 1722 msg->hdr.front_len = cpu_to_le32(msg->front.iov_len);
1723 1723
1724 msg->pages = req->r_pages; 1724 ceph_msg_data_set_pages(msg, req->r_pages, req->r_num_pages, 0);
1725 msg->page_count = req->r_num_pages; 1725
1726 msg->hdr.data_len = cpu_to_le32(req->r_data_len); 1726 msg->hdr.data_len = cpu_to_le32(req->r_data_len);
1727 msg->hdr.data_off = cpu_to_le16(0); 1727 msg->hdr.data_off = cpu_to_le16(0);
1728 1728
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
index 6c118748a7f8..aa463b9b30af 100644
--- a/include/linux/ceph/messenger.h
+++ b/include/linux/ceph/messenger.h
@@ -74,21 +74,22 @@ struct ceph_msg {
74 struct ceph_msg_footer footer; /* footer */ 74 struct ceph_msg_footer footer; /* footer */
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. */
78 unsigned page_count; /* size of page array */
79 unsigned page_alignment; /* io offset in first page */
80 struct ceph_pagelist *pagelist; /* instead of pages */
81
82 struct ceph_connection *con;
83 struct list_head list_head;
84 77
85 struct kref kref; 78 struct page **pages; /* data payload. NOT OWNER. */
79 unsigned int page_alignment; /* io offset in first page */
80 unsigned int page_count; /* # pages in array or list */
81 struct ceph_pagelist *pagelist; /* instead of pages */
86#ifdef CONFIG_BLOCK 82#ifdef CONFIG_BLOCK
83 unsigned int bio_seg; /* current bio segment */
87 struct bio *bio; /* instead of pages/pagelist */ 84 struct bio *bio; /* instead of pages/pagelist */
88 struct bio *bio_iter; /* bio iterator */ 85 struct bio *bio_iter; /* bio iterator */
89 unsigned int bio_seg; /* current bio segment */
90#endif /* CONFIG_BLOCK */ 86#endif /* CONFIG_BLOCK */
91 struct ceph_pagelist *trail; /* the trailing part of the data */ 87 struct ceph_pagelist *trail; /* the trailing part of the data */
88
89 struct ceph_connection *con;
90 struct list_head list_head; /* links for connection lists */
91
92 struct kref kref;
92 bool front_is_vmalloc; 93 bool front_is_vmalloc;
93 bool more_to_follow; 94 bool more_to_follow;
94 bool needs_out_seq; 95 bool needs_out_seq;
@@ -218,6 +219,9 @@ extern void ceph_msg_revoke_incoming(struct ceph_msg *msg);
218 219
219extern void ceph_con_keepalive(struct ceph_connection *con); 220extern void ceph_con_keepalive(struct ceph_connection *con);
220 221
222extern void ceph_msg_data_set_pages(struct ceph_msg *msg, struct page **pages,
223 unsigned int page_count, size_t alignment);
224
221extern struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags, 225extern struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags,
222 bool can_fail); 226 bool can_fail);
223extern void ceph_msg_kfree(struct ceph_msg *m); 227extern void ceph_msg_kfree(struct ceph_msg *m);
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index ce1669f75ca5..cec39cb623f0 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -2689,6 +2689,17 @@ void ceph_con_keepalive(struct ceph_connection *con)
2689} 2689}
2690EXPORT_SYMBOL(ceph_con_keepalive); 2690EXPORT_SYMBOL(ceph_con_keepalive);
2691 2691
2692void ceph_msg_data_set_pages(struct ceph_msg *msg, struct page **pages,
2693 unsigned int page_count, size_t alignment)
2694{
2695 /* BUG_ON(msg->pages); */
2696 /* BUG_ON(msg->page_count); */
2697
2698 msg->pages = pages;
2699 msg->page_count = page_count;
2700 msg->page_alignment = alignment & ~PAGE_MASK;
2701}
2702EXPORT_SYMBOL(ceph_msg_data_set_pages);
2692 2703
2693/* 2704/*
2694 * construct a new message with given type, size 2705 * construct a new message with given type, size
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 202af14dc6dc..a09d57134075 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -1760,11 +1760,10 @@ int ceph_osdc_start_request(struct ceph_osd_client *osdc,
1760 if (osd_data->type == CEPH_OSD_DATA_TYPE_PAGES) { 1760 if (osd_data->type == CEPH_OSD_DATA_TYPE_PAGES) {
1761 unsigned int page_count; 1761 unsigned int page_count;
1762 1762
1763 req->r_request->pages = osd_data->pages;
1764 page_count = calc_pages_for((u64)osd_data->alignment, 1763 page_count = calc_pages_for((u64)osd_data->alignment,
1765 (u64)osd_data->length); 1764 (u64)osd_data->length);
1766 req->r_request->page_count = page_count; 1765 ceph_msg_data_set_pages(req->r_request, osd_data->pages,
1767 req->r_request->page_alignment = osd_data->alignment; 1766 page_count, osd_data->alignment);
1768#ifdef CONFIG_BLOCK 1767#ifdef CONFIG_BLOCK
1769 } else if (osd_data->type == CEPH_OSD_DATA_TYPE_BIO) { 1768 } else if (osd_data->type == CEPH_OSD_DATA_TYPE_BIO) {
1770 req->r_request->bio = osd_data->bio; 1769 req->r_request->bio = osd_data->bio;
@@ -2135,9 +2134,8 @@ static struct ceph_msg *get_reply(struct ceph_connection *con,
2135 } 2134 }
2136 page_count = calc_pages_for((u64)osd_data->alignment, 2135 page_count = calc_pages_for((u64)osd_data->alignment,
2137 (u64)osd_data->length); 2136 (u64)osd_data->length);
2138 m->pages = osd_data->pages; 2137 ceph_msg_data_set_pages(m, osd_data->pages,
2139 m->page_count = page_count; 2138 osd_data->num_pages, osd_data->alignment);
2140 m->page_alignment = osd_data->alignment;
2141#ifdef CONFIG_BLOCK 2139#ifdef CONFIG_BLOCK
2142 } else if (osd_data->type == CEPH_OSD_DATA_TYPE_BIO) { 2140 } else if (osd_data->type == CEPH_OSD_DATA_TYPE_BIO) {
2143 m->bio = osd_data->bio; 2141 m->bio = osd_data->bio;