Skip to content

Commit b0b31a8

Browse files
committed
libceph: MOSDOpReply v7 encoding
Empty request_redirect_t (struct ceph_request_redirect in the kernel client) is now encoded with a bool. NEW_OSDOPREPLY_ENCODING feature bit overlaps with already supported CRUSH_TUNABLES5. Signed-off-by: Ilya Dryomov <[email protected]> Reviewed-by: Sage Weil <[email protected]>
1 parent 97db9a8 commit b0b31a8

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

include/linux/ceph/ceph_features.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@
7373
#define CEPH_FEATURE_MON_STATEFUL_SUB (1ULL<<57) /* stateful mon subscription */
7474
#define CEPH_FEATURE_MON_ROUTE_OSDMAP (1ULL<<57) /* peon sends osdmaps */
7575
#define CEPH_FEATURE_CRUSH_TUNABLES5 (1ULL<<58) /* chooseleaf stable mode */
76+
// duplicated since it was introduced at the same time as CEPH_FEATURE_CRUSH_TUNABLES5
77+
#define CEPH_FEATURE_NEW_OSDOPREPLY_ENCODING (1ULL<<58) /* New, v7 encoding */
7678

7779
/*
7880
* The introduction of CEPH_FEATURE_OSD_SNAPMAPPER caused the feature
@@ -119,7 +121,8 @@ static inline u64 ceph_sanitize_features(u64 features)
119121
CEPH_FEATURE_OSD_PRIMARY_AFFINITY | \
120122
CEPH_FEATURE_MSGR_KEEPALIVE2 | \
121123
CEPH_FEATURE_CRUSH_V4 | \
122-
CEPH_FEATURE_CRUSH_TUNABLES5)
124+
CEPH_FEATURE_CRUSH_TUNABLES5 | \
125+
CEPH_FEATURE_NEW_OSDOPREPLY_ENCODING)
123126

124127
#define CEPH_FEATURES_REQUIRED_DEFAULT \
125128
(CEPH_FEATURE_NOSRCADDR | \

net/ceph/osd_client.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1770,6 +1770,7 @@ static void handle_reply(struct ceph_osd_client *osdc, struct ceph_msg *msg)
17701770
u32 osdmap_epoch;
17711771
int already_completed;
17721772
u32 bytes;
1773+
u8 decode_redir;
17731774
unsigned int i;
17741775

17751776
tid = le64_to_cpu(msg->hdr.tid);
@@ -1841,6 +1842,15 @@ static void handle_reply(struct ceph_osd_client *osdc, struct ceph_msg *msg)
18411842
p += 8 + 4; /* skip replay_version */
18421843
p += 8; /* skip user_version */
18431844

1845+
if (le16_to_cpu(msg->hdr.version) >= 7)
1846+
ceph_decode_8_safe(&p, end, decode_redir, bad_put);
1847+
else
1848+
decode_redir = 1;
1849+
} else {
1850+
decode_redir = 0;
1851+
}
1852+
1853+
if (decode_redir) {
18441854
err = ceph_redirect_decode(&p, end, &redir);
18451855
if (err)
18461856
goto bad_put;

0 commit comments

Comments
 (0)