aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-04-10 15:25:30 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-04-10 15:25:30 -0400
commitb284d4d5a6785f8cd07eda2646a95782373cd01e (patch)
tree62d835dcb6a6eb30fe9b0ebad7aeba4b4234b1d6 /include
parenta7726f6b61e8917e73101bb8071facdff7ec5d72 (diff)
parent9122eed5281e89bdb02162a8ecb3cc13ffc8985e (diff)
Merge tag 'ceph-for-4.17-rc1' of git://github.com/ceph/ceph-client
Pull ceph updates from Ilya Dryomov: "The big ticket items are: - support for rbd "fancy" striping (myself). The striping feature bit is now fully implemented, allowing mapping v2 images with non-default striping patterns. This completes support for --image-format 2. - CephFS quota support (Luis Henriques and Zheng Yan). This set is based on the new SnapRealm code in the upcoming v13.y.z ("Mimic") release. Quota handling will be rejected on older filesystems. - memory usage improvements in CephFS (Chengguang Xu). Directory specific bits have been split out of ceph_file_info and some effort went into improving cap reservation code to avoid OOM crashes. Also included a bunch of assorted fixes all over the place from Chengguang and others" * tag 'ceph-for-4.17-rc1' of git://github.com/ceph/ceph-client: (67 commits) ceph: quota: report root dir quota usage in statfs ceph: quota: add counter for snaprealms with quota ceph: quota: cache inode pointer in ceph_snap_realm ceph: fix root quota realm check ceph: don't check quota for snap inode ceph: quota: update MDS when max_bytes is approaching ceph: quota: support for ceph.quota.max_bytes ceph: quota: don't allow cross-quota renames ceph: quota: support for ceph.quota.max_files ceph: quota: add initial infrastructure to support cephfs quotas rbd: remove VLA usage rbd: fix spelling mistake: "reregisteration" -> "reregistration" ceph: rename function drop_leases() to a more descriptive name ceph: fix invalid point dereference for error case in mdsc destroy ceph: return proper bool type to caller instead of pointer ceph: optimize memory usage ceph: optimize mds session register libceph, ceph: add __init attribution to init funcitons ceph: filter out used flags when printing unused open flags ceph: don't wait on writeback when there is no more dirty pages ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/ceph/ceph_features.h1
-rw-r--r--include/linux/ceph/ceph_fs.h17
-rw-r--r--include/linux/ceph/libceph.h1
-rw-r--r--include/linux/ceph/messenger.h101
-rw-r--r--include/linux/ceph/osd_client.h19
-rw-r--r--include/linux/ceph/osdmap.h6
-rw-r--r--include/linux/ceph/striper.h69
7 files changed, 195 insertions, 19 deletions
diff --git a/include/linux/ceph/ceph_features.h b/include/linux/ceph/ceph_features.h
index 59042d5ac520..3901927cf6a0 100644
--- a/include/linux/ceph/ceph_features.h
+++ b/include/linux/ceph/ceph_features.h
@@ -204,6 +204,7 @@ DEFINE_CEPH_FEATURE_DEPRECATED(63, 1, RESERVED_BROKEN, LUMINOUS) // client-facin
204 CEPH_FEATURE_OSD_PRIMARY_AFFINITY | \ 204 CEPH_FEATURE_OSD_PRIMARY_AFFINITY | \
205 CEPH_FEATURE_MSGR_KEEPALIVE2 | \ 205 CEPH_FEATURE_MSGR_KEEPALIVE2 | \
206 CEPH_FEATURE_OSD_POOLRESEND | \ 206 CEPH_FEATURE_OSD_POOLRESEND | \
207 CEPH_FEATURE_MDS_QUOTA | \
207 CEPH_FEATURE_CRUSH_V4 | \ 208 CEPH_FEATURE_CRUSH_V4 | \
208 CEPH_FEATURE_NEW_OSDOP_ENCODING | \ 209 CEPH_FEATURE_NEW_OSDOP_ENCODING | \
209 CEPH_FEATURE_SERVER_JEWEL | \ 210 CEPH_FEATURE_SERVER_JEWEL | \
diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
index 88dd51381aaf..7ecfc88314d8 100644
--- a/include/linux/ceph/ceph_fs.h
+++ b/include/linux/ceph/ceph_fs.h
@@ -134,6 +134,7 @@ struct ceph_dir_layout {
134#define CEPH_MSG_CLIENT_LEASE 0x311 134#define CEPH_MSG_CLIENT_LEASE 0x311
135#define CEPH_MSG_CLIENT_SNAP 0x312 135#define CEPH_MSG_CLIENT_SNAP 0x312
136#define CEPH_MSG_CLIENT_CAPRELEASE 0x313 136#define CEPH_MSG_CLIENT_CAPRELEASE 0x313
137#define CEPH_MSG_CLIENT_QUOTA 0x314
137 138
138/* pool ops */ 139/* pool ops */
139#define CEPH_MSG_POOLOP_REPLY 48 140#define CEPH_MSG_POOLOP_REPLY 48
@@ -807,4 +808,20 @@ struct ceph_mds_snap_realm {
807} __attribute__ ((packed)); 808} __attribute__ ((packed));
808/* followed by my snap list, then prior parent snap list */ 809/* followed by my snap list, then prior parent snap list */
809 810
811/*
812 * quotas
813 */
814struct ceph_mds_quota {
815 __le64 ino; /* ino */
816 struct ceph_timespec rctime;
817 __le64 rbytes; /* dir stats */
818 __le64 rfiles;
819 __le64 rsubdirs;
820 __u8 struct_v; /* compat */
821 __u8 struct_compat;
822 __le32 struct_len;
823 __le64 max_bytes; /* quota max. bytes */
824 __le64 max_files; /* quota max. files */
825} __attribute__ ((packed));
826
810#endif 827#endif
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index c2ec44cf5098..49c93b9308d7 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -262,6 +262,7 @@ extern struct kmem_cache *ceph_cap_cachep;
262extern struct kmem_cache *ceph_cap_flush_cachep; 262extern struct kmem_cache *ceph_cap_flush_cachep;
263extern struct kmem_cache *ceph_dentry_cachep; 263extern struct kmem_cache *ceph_dentry_cachep;
264extern struct kmem_cache *ceph_file_cachep; 264extern struct kmem_cache *ceph_file_cachep;
265extern struct kmem_cache *ceph_dir_file_cachep;
265 266
266/* ceph_common.c */ 267/* ceph_common.c */
267extern bool libceph_compatible(void *data); 268extern bool libceph_compatible(void *data);
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
index ead9d85f1c11..c7dfcb8a1fb2 100644
--- a/include/linux/ceph/messenger.h
+++ b/include/linux/ceph/messenger.h
@@ -76,6 +76,7 @@ enum ceph_msg_data_type {
76#ifdef CONFIG_BLOCK 76#ifdef CONFIG_BLOCK
77 CEPH_MSG_DATA_BIO, /* data source/destination is a bio list */ 77 CEPH_MSG_DATA_BIO, /* data source/destination is a bio list */
78#endif /* CONFIG_BLOCK */ 78#endif /* CONFIG_BLOCK */
79 CEPH_MSG_DATA_BVECS, /* data source/destination is a bio_vec array */
79}; 80};
80 81
81static __inline__ bool ceph_msg_data_type_valid(enum ceph_msg_data_type type) 82static __inline__ bool ceph_msg_data_type_valid(enum ceph_msg_data_type type)
@@ -87,22 +88,106 @@ static __inline__ bool ceph_msg_data_type_valid(enum ceph_msg_data_type type)
87#ifdef CONFIG_BLOCK 88#ifdef CONFIG_BLOCK
88 case CEPH_MSG_DATA_BIO: 89 case CEPH_MSG_DATA_BIO:
89#endif /* CONFIG_BLOCK */ 90#endif /* CONFIG_BLOCK */
91 case CEPH_MSG_DATA_BVECS:
90 return true; 92 return true;
91 default: 93 default:
92 return false; 94 return false;
93 } 95 }
94} 96}
95 97
98#ifdef CONFIG_BLOCK
99
100struct ceph_bio_iter {
101 struct bio *bio;
102 struct bvec_iter iter;
103};
104
105#define __ceph_bio_iter_advance_step(it, n, STEP) do { \
106 unsigned int __n = (n), __cur_n; \
107 \
108 while (__n) { \
109 BUG_ON(!(it)->iter.bi_size); \
110 __cur_n = min((it)->iter.bi_size, __n); \
111 (void)(STEP); \
112 bio_advance_iter((it)->bio, &(it)->iter, __cur_n); \
113 if (!(it)->iter.bi_size && (it)->bio->bi_next) { \
114 dout("__ceph_bio_iter_advance_step next bio\n"); \
115 (it)->bio = (it)->bio->bi_next; \
116 (it)->iter = (it)->bio->bi_iter; \
117 } \
118 __n -= __cur_n; \
119 } \
120} while (0)
121
122/*
123 * Advance @it by @n bytes.
124 */
125#define ceph_bio_iter_advance(it, n) \
126 __ceph_bio_iter_advance_step(it, n, 0)
127
128/*
129 * Advance @it by @n bytes, executing BVEC_STEP for each bio_vec.
130 */
131#define ceph_bio_iter_advance_step(it, n, BVEC_STEP) \
132 __ceph_bio_iter_advance_step(it, n, ({ \
133 struct bio_vec bv; \
134 struct bvec_iter __cur_iter; \
135 \
136 __cur_iter = (it)->iter; \
137 __cur_iter.bi_size = __cur_n; \
138 __bio_for_each_segment(bv, (it)->bio, __cur_iter, __cur_iter) \
139 (void)(BVEC_STEP); \
140 }))
141
142#endif /* CONFIG_BLOCK */
143
144struct ceph_bvec_iter {
145 struct bio_vec *bvecs;
146 struct bvec_iter iter;
147};
148
149#define __ceph_bvec_iter_advance_step(it, n, STEP) do { \
150 BUG_ON((n) > (it)->iter.bi_size); \
151 (void)(STEP); \
152 bvec_iter_advance((it)->bvecs, &(it)->iter, (n)); \
153} while (0)
154
155/*
156 * Advance @it by @n bytes.
157 */
158#define ceph_bvec_iter_advance(it, n) \
159 __ceph_bvec_iter_advance_step(it, n, 0)
160
161/*
162 * Advance @it by @n bytes, executing BVEC_STEP for each bio_vec.
163 */
164#define ceph_bvec_iter_advance_step(it, n, BVEC_STEP) \
165 __ceph_bvec_iter_advance_step(it, n, ({ \
166 struct bio_vec bv; \
167 struct bvec_iter __cur_iter; \
168 \
169 __cur_iter = (it)->iter; \
170 __cur_iter.bi_size = (n); \
171 for_each_bvec(bv, (it)->bvecs, __cur_iter, __cur_iter) \
172 (void)(BVEC_STEP); \
173 }))
174
175#define ceph_bvec_iter_shorten(it, n) do { \
176 BUG_ON((n) > (it)->iter.bi_size); \
177 (it)->iter.bi_size = (n); \
178} while (0)
179
96struct ceph_msg_data { 180struct ceph_msg_data {
97 struct list_head links; /* ceph_msg->data */ 181 struct list_head links; /* ceph_msg->data */
98 enum ceph_msg_data_type type; 182 enum ceph_msg_data_type type;
99 union { 183 union {
100#ifdef CONFIG_BLOCK 184#ifdef CONFIG_BLOCK
101 struct { 185 struct {
102 struct bio *bio; 186 struct ceph_bio_iter bio_pos;
103 size_t bio_length; 187 u32 bio_length;
104 }; 188 };
105#endif /* CONFIG_BLOCK */ 189#endif /* CONFIG_BLOCK */
190 struct ceph_bvec_iter bvec_pos;
106 struct { 191 struct {
107 struct page **pages; /* NOT OWNER. */ 192 struct page **pages; /* NOT OWNER. */
108 size_t length; /* total # bytes */ 193 size_t length; /* total # bytes */
@@ -122,11 +207,9 @@ struct ceph_msg_data_cursor {
122 bool need_crc; /* crc update needed */ 207 bool need_crc; /* crc update needed */
123 union { 208 union {
124#ifdef CONFIG_BLOCK 209#ifdef CONFIG_BLOCK
125 struct { /* bio */ 210 struct ceph_bio_iter bio_iter;
126 struct bio *bio; /* bio from list */
127 struct bvec_iter bvec_iter;
128 };
129#endif /* CONFIG_BLOCK */ 211#endif /* CONFIG_BLOCK */
212 struct bvec_iter bvec_iter;
130 struct { /* pages */ 213 struct { /* pages */
131 unsigned int page_offset; /* offset in page */ 214 unsigned int page_offset; /* offset in page */
132 unsigned short page_index; /* index in array */ 215 unsigned short page_index; /* index in array */
@@ -290,9 +373,11 @@ extern void ceph_msg_data_add_pages(struct ceph_msg *msg, struct page **pages,
290extern void ceph_msg_data_add_pagelist(struct ceph_msg *msg, 373extern void ceph_msg_data_add_pagelist(struct ceph_msg *msg,
291 struct ceph_pagelist *pagelist); 374 struct ceph_pagelist *pagelist);
292#ifdef CONFIG_BLOCK 375#ifdef CONFIG_BLOCK
293extern void ceph_msg_data_add_bio(struct ceph_msg *msg, struct bio *bio, 376void ceph_msg_data_add_bio(struct ceph_msg *msg, struct ceph_bio_iter *bio_pos,
294 size_t length); 377 u32 length);
295#endif /* CONFIG_BLOCK */ 378#endif /* CONFIG_BLOCK */
379void ceph_msg_data_add_bvecs(struct ceph_msg *msg,
380 struct ceph_bvec_iter *bvec_pos);
296 381
297extern struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags, 382extern struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags,
298 bool can_fail); 383 bool can_fail);
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index 52fb37d1c2a5..528ccc943cee 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -57,6 +57,7 @@ enum ceph_osd_data_type {
57#ifdef CONFIG_BLOCK 57#ifdef CONFIG_BLOCK
58 CEPH_OSD_DATA_TYPE_BIO, 58 CEPH_OSD_DATA_TYPE_BIO,
59#endif /* CONFIG_BLOCK */ 59#endif /* CONFIG_BLOCK */
60 CEPH_OSD_DATA_TYPE_BVECS,
60}; 61};
61 62
62struct ceph_osd_data { 63struct ceph_osd_data {
@@ -72,10 +73,11 @@ struct ceph_osd_data {
72 struct ceph_pagelist *pagelist; 73 struct ceph_pagelist *pagelist;
73#ifdef CONFIG_BLOCK 74#ifdef CONFIG_BLOCK
74 struct { 75 struct {
75 struct bio *bio; /* list of bios */ 76 struct ceph_bio_iter bio_pos;
76 size_t bio_length; /* total in list */ 77 u32 bio_length;
77 }; 78 };
78#endif /* CONFIG_BLOCK */ 79#endif /* CONFIG_BLOCK */
80 struct ceph_bvec_iter bvec_pos;
79 }; 81 };
80}; 82};
81 83
@@ -405,10 +407,14 @@ extern void osd_req_op_extent_osd_data_pagelist(struct ceph_osd_request *,
405 unsigned int which, 407 unsigned int which,
406 struct ceph_pagelist *pagelist); 408 struct ceph_pagelist *pagelist);
407#ifdef CONFIG_BLOCK 409#ifdef CONFIG_BLOCK
408extern void osd_req_op_extent_osd_data_bio(struct ceph_osd_request *, 410void osd_req_op_extent_osd_data_bio(struct ceph_osd_request *osd_req,
409 unsigned int which, 411 unsigned int which,
410 struct bio *bio, size_t bio_length); 412 struct ceph_bio_iter *bio_pos,
413 u32 bio_length);
411#endif /* CONFIG_BLOCK */ 414#endif /* CONFIG_BLOCK */
415void osd_req_op_extent_osd_data_bvec_pos(struct ceph_osd_request *osd_req,
416 unsigned int which,
417 struct ceph_bvec_iter *bvec_pos);
412 418
413extern void osd_req_op_cls_request_data_pagelist(struct ceph_osd_request *, 419extern void osd_req_op_cls_request_data_pagelist(struct ceph_osd_request *,
414 unsigned int which, 420 unsigned int which,
@@ -418,6 +424,9 @@ extern void osd_req_op_cls_request_data_pages(struct ceph_osd_request *,
418 struct page **pages, u64 length, 424 struct page **pages, u64 length,
419 u32 alignment, bool pages_from_pool, 425 u32 alignment, bool pages_from_pool,
420 bool own_pages); 426 bool own_pages);
427void osd_req_op_cls_request_data_bvecs(struct ceph_osd_request *osd_req,
428 unsigned int which,
429 struct bio_vec *bvecs, u32 bytes);
421extern void osd_req_op_cls_response_data_pages(struct ceph_osd_request *, 430extern void osd_req_op_cls_response_data_pages(struct ceph_osd_request *,
422 unsigned int which, 431 unsigned int which,
423 struct page **pages, u64 length, 432 struct page **pages, u64 length,
diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h
index d41fad99c0fa..e71fb222c7c3 100644
--- a/include/linux/ceph/osdmap.h
+++ b/include/linux/ceph/osdmap.h
@@ -5,7 +5,6 @@
5#include <linux/rbtree.h> 5#include <linux/rbtree.h>
6#include <linux/ceph/types.h> 6#include <linux/ceph/types.h>
7#include <linux/ceph/decode.h> 7#include <linux/ceph/decode.h>
8#include <linux/ceph/ceph_fs.h>
9#include <linux/crush/crush.h> 8#include <linux/crush/crush.h>
10 9
11/* 10/*
@@ -280,11 +279,6 @@ bool ceph_osds_changed(const struct ceph_osds *old_acting,
280 const struct ceph_osds *new_acting, 279 const struct ceph_osds *new_acting,
281 bool any_change); 280 bool any_change);
282 281
283/* calculate mapping of a file extent to an object */
284extern int ceph_calc_file_object_mapping(struct ceph_file_layout *layout,
285 u64 off, u64 len,
286 u64 *bno, u64 *oxoff, u64 *oxlen);
287
288int __ceph_object_locator_to_pg(struct ceph_pg_pool_info *pi, 282int __ceph_object_locator_to_pg(struct ceph_pg_pool_info *pi,
289 const struct ceph_object_id *oid, 283 const struct ceph_object_id *oid,
290 const struct ceph_object_locator *oloc, 284 const struct ceph_object_locator *oloc,
diff --git a/include/linux/ceph/striper.h b/include/linux/ceph/striper.h
new file mode 100644
index 000000000000..cbd0d24b7148
--- /dev/null
+++ b/include/linux/ceph/striper.h
@@ -0,0 +1,69 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _LINUX_CEPH_STRIPER_H
3#define _LINUX_CEPH_STRIPER_H
4
5#include <linux/list.h>
6#include <linux/types.h>
7
8struct ceph_file_layout;
9
10void ceph_calc_file_object_mapping(struct ceph_file_layout *l,
11 u64 off, u64 len,
12 u64 *objno, u64 *objoff, u32 *xlen);
13
14struct ceph_object_extent {
15 struct list_head oe_item;
16 u64 oe_objno;
17 u64 oe_off;
18 u64 oe_len;
19};
20
21static inline void ceph_object_extent_init(struct ceph_object_extent *ex)
22{
23 INIT_LIST_HEAD(&ex->oe_item);
24}
25
26/*
27 * Called for each mapped stripe unit.
28 *
29 * @bytes: number of bytes mapped, i.e. the minimum of the full length
30 * requested (file extent length) or the remainder of the stripe
31 * unit within an object
32 */
33typedef void (*ceph_object_extent_fn_t)(struct ceph_object_extent *ex,
34 u32 bytes, void *arg);
35
36int ceph_file_to_extents(struct ceph_file_layout *l, u64 off, u64 len,
37 struct list_head *object_extents,
38 struct ceph_object_extent *alloc_fn(void *arg),
39 void *alloc_arg,
40 ceph_object_extent_fn_t action_fn,
41 void *action_arg);
42int ceph_iterate_extents(struct ceph_file_layout *l, u64 off, u64 len,
43 struct list_head *object_extents,
44 ceph_object_extent_fn_t action_fn,
45 void *action_arg);
46
47struct ceph_file_extent {
48 u64 fe_off;
49 u64 fe_len;
50};
51
52static inline u64 ceph_file_extents_bytes(struct ceph_file_extent *file_extents,
53 u32 num_file_extents)
54{
55 u64 bytes = 0;
56 u32 i;
57
58 for (i = 0; i < num_file_extents; i++)
59 bytes += file_extents[i].fe_len;
60
61 return bytes;
62}
63
64int ceph_extent_to_file(struct ceph_file_layout *l,
65 u64 objno, u64 objoff, u64 objlen,
66 struct ceph_file_extent **file_extents,
67 u32 *num_file_extents);
68
69#endif