aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2013-02-15 12:42:29 -0500
committerAlex Elder <elder@inktank.com>2013-02-18 13:19:54 -0500
commit60e56f138180e72fa8487d4b9c1c916013494f46 (patch)
treee3fb48ffc88d22680167ed51946df024623a463a /net
parent60789380ae833061803030d51952a5a341e4dade (diff)
libceph: kill ceph_calc_raw_layout()
There is no caller of ceph_calc_raw_layout() outside of libceph, so there's no need to export from the module. Furthermore, there is only one caller, in calc_layout(), and it is not much more than a simple wrapper for that function. So get rid of ceph_calc_raw_layout() and embed it instead within calc_layout(). While touching "osd_client.c", get rid of the unnecessary forward declaration of __send_request(). Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'net')
-rw-r--r--net/ceph/osd_client.c77
1 files changed, 32 insertions, 45 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 0d67cd37173b..cd3a489b7438 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -38,49 +38,6 @@ static int op_has_extent(int op)
38 op == CEPH_OSD_OP_WRITE); 38 op == CEPH_OSD_OP_WRITE);
39} 39}
40 40
41int ceph_calc_raw_layout(struct ceph_file_layout *layout,
42 u64 off, u64 *plen, u64 *bno,
43 struct ceph_osd_request *req,
44 struct ceph_osd_req_op *op)
45{
46 u64 orig_len = *plen;
47 u64 objoff, objlen; /* extent in object */
48 int r;
49
50 /* object extent? */
51 r = ceph_calc_file_object_mapping(layout, off, orig_len, bno,
52 &objoff, &objlen);
53 if (r < 0)
54 return r;
55 if (objlen < orig_len) {
56 *plen = objlen;
57 dout(" skipping last %llu, final file extent %llu~%llu\n",
58 orig_len - *plen, off, *plen);
59 }
60
61 if (op_has_extent(op->op)) {
62 u32 osize = le32_to_cpu(layout->fl_object_size);
63 op->extent.offset = objoff;
64 op->extent.length = objlen;
65 if (op->extent.truncate_size <= off - objoff) {
66 op->extent.truncate_size = 0;
67 } else {
68 op->extent.truncate_size -= off - objoff;
69 if (op->extent.truncate_size > osize)
70 op->extent.truncate_size = osize;
71 }
72 }
73 req->r_num_pages = calc_pages_for(off, *plen);
74 req->r_page_alignment = off & ~PAGE_MASK;
75 if (op->op == CEPH_OSD_OP_WRITE)
76 op->payload_len = *plen;
77
78 dout("calc_layout bno=%llx %llu~%llu (%d pages)\n",
79 *bno, objoff, objlen, req->r_num_pages);
80 return 0;
81}
82EXPORT_SYMBOL(ceph_calc_raw_layout);
83
84/* 41/*
85 * Implement client access to distributed object storage cluster. 42 * Implement client access to distributed object storage cluster.
86 * 43 *
@@ -112,12 +69,42 @@ static int calc_layout(struct ceph_vino vino,
112 struct ceph_osd_request *req, 69 struct ceph_osd_request *req,
113 struct ceph_osd_req_op *op) 70 struct ceph_osd_req_op *op)
114{ 71{
115 u64 bno; 72 u64 orig_len = *plen;
73 u64 bno = 0;
74 u64 objoff = 0;
75 u64 objlen = 0;
116 int r; 76 int r;
117 77
118 r = ceph_calc_raw_layout(layout, off, plen, &bno, req, op); 78 /* object extent? */
79 r = ceph_calc_file_object_mapping(layout, off, orig_len, &bno,
80 &objoff, &objlen);
119 if (r < 0) 81 if (r < 0)
120 return r; 82 return r;
83 if (objlen < orig_len) {
84 *plen = objlen;
85 dout(" skipping last %llu, final file extent %llu~%llu\n",
86 orig_len - *plen, off, *plen);
87 }
88
89 if (op_has_extent(op->op)) {
90 u32 osize = le32_to_cpu(layout->fl_object_size);
91 op->extent.offset = objoff;
92 op->extent.length = objlen;
93 if (op->extent.truncate_size <= off - objoff) {
94 op->extent.truncate_size = 0;
95 } else {
96 op->extent.truncate_size -= off - objoff;
97 if (op->extent.truncate_size > osize)
98 op->extent.truncate_size = osize;
99 }
100 }
101 req->r_num_pages = calc_pages_for(off, *plen);
102 req->r_page_alignment = off & ~PAGE_MASK;
103 if (op->op == CEPH_OSD_OP_WRITE)
104 op->payload_len = *plen;
105
106 dout("calc_layout bno=%llx %llu~%llu (%d pages)\n",
107 bno, objoff, objlen, req->r_num_pages);
121 108
122 snprintf(req->r_oid, sizeof(req->r_oid), "%llx.%08llx", vino.ino, bno); 109 snprintf(req->r_oid, sizeof(req->r_oid), "%llx.%08llx", vino.ino, bno);
123 req->r_oid_len = strlen(req->r_oid); 110 req->r_oid_len = strlen(req->r_oid);