libceph: remove dead code in osd_req_encode_op()
authorAlex Elder <elder@inktank.com>
Fri, 15 Feb 2013 17:42:30 +0000 (11:42 -0600)
committerAlex Elder <elder@inktank.com>
Mon, 18 Feb 2013 18:20:26 +0000 (12:20 -0600)
In osd_req_encode_op() there are a few cases that handle osd
opcodes that are never used in the kernel.  The presence of
this code gives the impression it's correct (which really can't
be assumed), and may impose some unnecessary restrictions on
some upcoming refactoring of this code.

So delete this effectively dead code, and report uses of the
previously handled cases as unsupported.

Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
net/ceph/osd_client.c

index ac7bcbf..bbd1575 100644 (file)
@@ -231,19 +231,6 @@ static void osd_req_encode_op(struct ceph_osd_request *req,
                dst->extent.truncate_seq =
                        cpu_to_le32(src->extent.truncate_seq);
                break;
-
-       case CEPH_OSD_OP_GETXATTR:
-       case CEPH_OSD_OP_SETXATTR:
-       case CEPH_OSD_OP_CMPXATTR:
-               dst->xattr.name_len = cpu_to_le32(src->xattr.name_len);
-               dst->xattr.value_len = cpu_to_le32(src->xattr.value_len);
-               dst->xattr.cmp_op = src->xattr.cmp_op;
-               dst->xattr.cmp_mode = src->xattr.cmp_mode;
-               ceph_pagelist_append(&req->r_trail, src->xattr.name,
-                                    src->xattr.name_len);
-               ceph_pagelist_append(&req->r_trail, src->xattr.val,
-                                    src->xattr.value_len);
-               break;
        case CEPH_OSD_OP_CALL:
                dst->cls.class_len = src->cls.class_len;
                dst->cls.method_len = src->cls.method_len;
@@ -256,21 +243,8 @@ static void osd_req_encode_op(struct ceph_osd_request *req,
                ceph_pagelist_append(&req->r_trail, src->cls.indata,
                                     src->cls.indata_len);
                break;
-       case CEPH_OSD_OP_ROLLBACK:
-               dst->snap.snapid = cpu_to_le64(src->snap.snapid);
-               break;
        case CEPH_OSD_OP_STARTSYNC:
                break;
-       case CEPH_OSD_OP_NOTIFY:
-               {
-                       __le32 prot_ver = cpu_to_le32(src->watch.prot_ver);
-                       __le32 timeout = cpu_to_le32(src->watch.timeout);
-
-                       ceph_pagelist_append(&req->r_trail,
-                                               &prot_ver, sizeof(prot_ver));
-                       ceph_pagelist_append(&req->r_trail,
-                                               &timeout, sizeof(timeout));
-               }
        case CEPH_OSD_OP_NOTIFY_ACK:
        case CEPH_OSD_OP_WATCH:
                dst->watch.cookie = cpu_to_le64(src->watch.cookie);
@@ -285,6 +259,7 @@ static void osd_req_encode_op(struct ceph_osd_request *req,
        case CEPH_OSD_OP_MAPEXT:
        case CEPH_OSD_OP_MASKTRUNC:
        case CEPH_OSD_OP_SPARSE_READ:
+       case CEPH_OSD_OP_NOTIFY:
        case CEPH_OSD_OP_ASSERT_VER:
        case CEPH_OSD_OP_WRITEFULL:
        case CEPH_OSD_OP_TRUNCATE:
@@ -297,6 +272,7 @@ static void osd_req_encode_op(struct ceph_osd_request *req,
        case CEPH_OSD_OP_TMAPPUT:
        case CEPH_OSD_OP_TMAPGET:
        case CEPH_OSD_OP_CREATE:
+       case CEPH_OSD_OP_ROLLBACK:
        case CEPH_OSD_OP_OMAPGETKEYS:
        case CEPH_OSD_OP_OMAPGETVALS:
        case CEPH_OSD_OP_OMAPGETHEADER:
@@ -310,7 +286,10 @@ static void osd_req_encode_op(struct ceph_osd_request *req,
        case CEPH_OSD_OP_CLONERANGE:
        case CEPH_OSD_OP_ASSERT_SRC_VERSION:
        case CEPH_OSD_OP_SRC_CMPXATTR:
+       case CEPH_OSD_OP_GETXATTR:
        case CEPH_OSD_OP_GETXATTRS:
+       case CEPH_OSD_OP_CMPXATTR:
+       case CEPH_OSD_OP_SETXATTR:
        case CEPH_OSD_OP_SETXATTRS:
        case CEPH_OSD_OP_RESETXATTRS:
        case CEPH_OSD_OP_RMXATTR: