Project

General

Profile

0001-add-support-for-osd-copy-file-feature.patch

Kernel support for osd copy-file feature - Luis Henriques, 04/02/2019 03:21 PM

Download (5.88 KB)

View differences:

fs/ceph/file.c
2042 2042
			CEPH_OSD_OP_FLAG_FADVISE_NOCACHE,
2043 2043
			&dst_oid, &dst_oloc,
2044 2044
			CEPH_OSD_OP_FLAG_FADVISE_SEQUENTIAL |
2045
			CEPH_OSD_OP_FLAG_FADVISE_DONTNEED, 0);
2045
			CEPH_OSD_OP_FLAG_FADVISE_DONTNEED,
2046
			dst_ci->i_truncate_seq, dst_ci->i_truncate_size,
2047
			CEPH_OSD_COPY_FROM_FLAG_TRUNCATE_SEQ);
2046 2048
		if (err) {
2047 2049
			dout("ceph_osdc_copy_from returned %d\n", err);
2048 2050
			if (!ret)
include/linux/ceph/ceph_features.h
9 9
 */
10 10
#define CEPH_FEATURE_INCARNATION_1 (0ull)
11 11
#define CEPH_FEATURE_INCARNATION_2 (1ull<<57) // CEPH_FEATURE_SERVER_JEWEL
12
#define CEPH_FEATURE_INCARNATION_3 ((1ull<<57)|(1ull<<28)) // SERVER_MIMIC
12 13

  
13 14
#define DEFINE_CEPH_FEATURE(bit, incarnation, name)			\
14 15
	static const uint64_t CEPH_FEATURE_##name = (1ULL<<bit);		\
......
76 77
DEFINE_CEPH_FEATURE( 1, 1, NOSRCADDR)
77 78
DEFINE_CEPH_FEATURE_RETIRED( 2, 1, MONCLOCKCHECK, JEWEL, LUMINOUS)
78 79

  
80
DEFINE_CEPH_FEATURE( 2, 3, SERVER_NAUTILUS)
79 81
DEFINE_CEPH_FEATURE( 3, 1, FLOCK)
80 82
DEFINE_CEPH_FEATURE( 4, 1, SUBSCRIBE2)
81 83
DEFINE_CEPH_FEATURE( 5, 1, MONNAMES)
......
98 100
DEFINE_CEPH_FEATURE_RETIRED(19, 1, CHUNKY_SCRUB, JEWEL, LUMINOUS)
99 101

  
100 102
DEFINE_CEPH_FEATURE_RETIRED(20, 1, MON_NULLROUTE, JEWEL, LUMINOUS)
103
DEFINE_CEPH_FEATURE(20, 2, OSD_COPY_FILE)
101 104

  
102 105
DEFINE_CEPH_FEATURE_RETIRED(21, 1, MON_GV, HAMMER, JEWEL)
103 106
DEFINE_CEPH_FEATURE(21, 2, SERVER_LUMINOUS)
......
211 214
	 CEPH_FEATURE_MON_STATEFUL_SUB |	\
212 215
	 CEPH_FEATURE_CRUSH_TUNABLES5 |		\
213 216
	 CEPH_FEATURE_NEW_OSDOPREPLY_ENCODING |	\
214
	 CEPH_FEATURE_CEPHX_V2)
217
	 CEPH_FEATURE_CEPHX_V2 |		\
218
	 CEPH_FEATURE_OSD_COPY_FILE)
215 219

  
216 220
#define CEPH_FEATURES_REQUIRED_DEFAULT	0
217 221

  
include/linux/ceph/osd_client.h
524 524
			struct ceph_object_id *dst_oid,
525 525
			struct ceph_object_locator *dst_oloc,
526 526
			u32 dst_fadvise_flags,
527
			u32 truncate_seq, u64 truncate_size,
527 528
			u8 copy_from_flags);
528 529

  
529 530
/* watch/notify */
include/linux/ceph/rados.h
446 446
	CEPH_OSD_COPY_FROM_FLAG_MAP_SNAP_CLONE = 8, /* map snap direct to
447 447
						     * cloneid */
448 448
	CEPH_OSD_COPY_FROM_FLAG_RWORDERED = 16,     /* order with write */
449
	CEPH_OSD_COPY_FROM_FLAG_TRUNCATE_SEQ = 32,  /* send truncate_{seq,size} */
449 450
};
450 451

  
451 452
enum {
net/ceph/osd_client.c
2265 2265
		ceph_monc_renew_subs(&osdc->client->monc);
2266 2266
}
2267 2267

  
2268
static bool check_con_features(struct ceph_connection *con,
2269
			       struct ceph_osd_request *req)
2270
{
2271
	int i;
2272

  
2273
	for (i = 0; i < req->r_num_ops; i++) {
2274
		switch (req->r_ops[i].op) {
2275
		case CEPH_OSD_OP_COPY_FROM:
2276
			if (!CEPH_HAVE_FEATURE(con->peer_features,
2277
					       OSD_COPY_FILE))
2278
				return false;
2279
			break;
2280
		}
2281
	}
2282
	return true;
2283
}
2284

  
2268 2285
static void complete_request(struct ceph_osd_request *req, int err);
2269 2286
static void send_map_check(struct ceph_osd_request *req);
2270 2287

  
......
2329 2346
	}
2330 2347

  
2331 2348
	mutex_lock(&osd->lock);
2349
	if (!check_con_features(&osd->o_con, req)) {
2350
		err = -EOPNOTSUPP;
2351
		need_send = false;
2352
	}
2332 2353
	/*
2333 2354
	 * Assign the tid atomically with send_request() to protect
2334 2355
	 * multiple writes to the same object from racing with each
......
5277 5298
				     struct ceph_object_locator *src_oloc,
5278 5299
				     u32 src_fadvise_flags,
5279 5300
				     u32 dst_fadvise_flags,
5301
				     u32 truncate_seq, u64 truncate_size,
5280 5302
				     u8 copy_from_flags)
5281 5303
{
5282 5304
	struct ceph_osd_req_op *op;
......
5297 5319
	end = p + PAGE_SIZE;
5298 5320
	ceph_encode_string(&p, end, src_oid->name, src_oid->name_len);
5299 5321
	encode_oloc(&p, end, src_oloc);
5322
	ceph_encode_32(&p, truncate_seq);
5323
	ceph_encode_64(&p, truncate_size);
5300 5324
	op->indata_len = PAGE_SIZE - (end - p);
5301 5325

  
5302 5326
	ceph_osd_data_pages_init(&op->copy_from.osd_data, pages,
......
5312 5336
			struct ceph_object_id *dst_oid,
5313 5337
			struct ceph_object_locator *dst_oloc,
5314 5338
			u32 dst_fadvise_flags,
5339
			u32 truncate_seq, u64 truncate_size,
5315 5340
			u8 copy_from_flags)
5316 5341
{
5317 5342
	struct ceph_osd_request *req;
......
5328 5353

  
5329 5354
	ret = osd_req_op_copy_from_init(req, src_snapid, src_version, src_oid,
5330 5355
					src_oloc, src_fadvise_flags,
5331
					dst_fadvise_flags, copy_from_flags);
5356
					dst_fadvise_flags, truncate_seq,
5357
					truncate_size, copy_from_flags);
5332 5358
	if (ret)
5333 5359
		goto out;
5334 5360