Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

libceph: nuke pool op infrastructure

On Mon, Dec 22, 2014 at 5:35 PM, Sage Weil <sage@newdream.net> wrote:
> On Mon, 22 Dec 2014, Ilya Dryomov wrote:
>> Actually, pool op stuff has been unused for over two years - looks like
>> it was added for rbd create_snap and that got ripped out in 2012. It's
>> unlikely we'd ever need to manage pools or snaps from the kernel client
>> so I think it makes sense to nuke it. Sage?
>
> Yep!

Signed-off-by: Ilya Dryomov <idryomov@redhat.com>

authored by

Ilya Dryomov and committed by
Ilya Dryomov
7a6fdeb2 bfa76d49

+4 -192
-36
include/linux/ceph/ceph_fs.h
··· 158 158 }; 159 159 160 160 161 - /* pool operations */ 162 - enum { 163 - POOL_OP_CREATE = 0x01, 164 - POOL_OP_DELETE = 0x02, 165 - POOL_OP_AUID_CHANGE = 0x03, 166 - POOL_OP_CREATE_SNAP = 0x11, 167 - POOL_OP_DELETE_SNAP = 0x12, 168 - POOL_OP_CREATE_UNMANAGED_SNAP = 0x21, 169 - POOL_OP_DELETE_UNMANAGED_SNAP = 0x22, 170 - }; 171 - 172 161 struct ceph_mon_request_header { 173 162 __le64 have_version; 174 163 __le16 session_mon; ··· 178 189 struct ceph_fsid fsid; 179 190 __le64 version; 180 191 struct ceph_statfs st; 181 - } __attribute__ ((packed)); 182 - 183 - const char *ceph_pool_op_name(int op); 184 - 185 - struct ceph_mon_poolop { 186 - struct ceph_mon_request_header monhdr; 187 - struct ceph_fsid fsid; 188 - __le32 pool; 189 - __le32 op; 190 - __le64 auid; 191 - __le64 snapid; 192 - __le32 name_len; 193 - } __attribute__ ((packed)); 194 - 195 - struct ceph_mon_poolop_reply { 196 - struct ceph_mon_request_header monhdr; 197 - struct ceph_fsid fsid; 198 - __le32 reply_code; 199 - __le32 epoch; 200 - char has_data; 201 - char data[0]; 202 - } __attribute__ ((packed)); 203 - 204 - struct ceph_mon_unmanaged_snap { 205 - __le64 snapid; 206 192 } __attribute__ ((packed)); 207 193 208 194 struct ceph_osd_getmap {
+1 -8
include/linux/ceph/mon_client.h
··· 40 40 }; 41 41 42 42 /* 43 - * ceph_mon_generic_request is being used for the statfs, poolop and 43 + * ceph_mon_generic_request is being used for the statfs and 44 44 * mon_get_version requests which are being done a bit differently 45 45 * because we need to get data back to the caller 46 46 */ ··· 50 50 struct rb_node node; 51 51 int result; 52 52 void *buf; 53 - int buf_len; 54 53 struct completion completion; 55 54 struct ceph_msg *request; /* original request */ 56 55 struct ceph_msg *reply; /* and reply */ ··· 115 116 extern int ceph_monc_open_session(struct ceph_mon_client *monc); 116 117 117 118 extern int ceph_monc_validate_auth(struct ceph_mon_client *monc); 118 - 119 - extern int ceph_monc_create_snapid(struct ceph_mon_client *monc, 120 - u32 pool, u64 *snapid); 121 - 122 - extern int ceph_monc_delete_snapid(struct ceph_mon_client *monc, 123 - u32 pool, u64 snapid); 124 119 125 120 #endif
-14
net/ceph/ceph_strings.c
··· 42 42 return "???"; 43 43 } 44 44 } 45 - 46 - const char *ceph_pool_op_name(int op) 47 - { 48 - switch (op) { 49 - case POOL_OP_CREATE: return "create"; 50 - case POOL_OP_DELETE: return "delete"; 51 - case POOL_OP_AUID_CHANGE: return "auid change"; 52 - case POOL_OP_CREATE_SNAP: return "create snap"; 53 - case POOL_OP_DELETE_SNAP: return "delete snap"; 54 - case POOL_OP_CREATE_UNMANAGED_SNAP: return "create unmanaged snap"; 55 - case POOL_OP_DELETE_UNMANAGED_SNAP: return "delete unmanaged snap"; 56 - } 57 - return "???"; 58 - }
-2
net/ceph/debugfs.c
··· 127 127 op = le16_to_cpu(req->request->hdr.type); 128 128 if (op == CEPH_MSG_STATFS) 129 129 seq_printf(s, "%llu statfs\n", req->tid); 130 - else if (op == CEPH_MSG_POOLOP) 131 - seq_printf(s, "%llu poolop\n", req->tid); 132 130 else if (op == CEPH_MSG_MON_GET_VERSION) 133 131 seq_printf(s, "%llu mon_get_version", req->tid); 134 132 else
+3 -132
net/ceph/mon_client.c
··· 410 410 } 411 411 412 412 /* 413 - * generic requests (e.g., statfs, poolop) 413 + * generic requests (currently statfs, mon_get_version) 414 414 */ 415 415 static struct ceph_mon_generic_request *__lookup_generic_req( 416 416 struct ceph_mon_client *monc, u64 tid) ··· 569 569 return; 570 570 571 571 bad: 572 - pr_err("corrupt generic reply, tid %llu\n", tid); 572 + pr_err("corrupt statfs reply, tid %llu\n", tid); 573 573 ceph_msg_dump(msg); 574 574 } 575 575 ··· 588 588 589 589 kref_init(&req->kref); 590 590 req->buf = buf; 591 - req->buf_len = sizeof(*buf); 592 591 init_completion(&req->completion); 593 592 594 593 err = -ENOMEM; ··· 646 647 647 648 return; 648 649 bad: 649 - pr_err("corrupt mon_get_version reply\n"); 650 + pr_err("corrupt mon_get_version reply, tid %llu\n", tid); 650 651 ceph_msg_dump(msg); 651 652 } 652 653 ··· 669 670 670 671 kref_init(&req->kref); 671 672 req->buf = newest; 672 - req->buf_len = sizeof(*newest); 673 673 init_completion(&req->completion); 674 674 675 675 req->request = ceph_msg_new(CEPH_MSG_MON_GET_VERSION, ··· 703 705 return err; 704 706 } 705 707 EXPORT_SYMBOL(ceph_monc_do_get_version); 706 - 707 - /* 708 - * pool ops 709 - */ 710 - static int get_poolop_reply_buf(const char *src, size_t src_len, 711 - char *dst, size_t dst_len) 712 - { 713 - u32 buf_len; 714 - 715 - if (src_len != sizeof(u32) + dst_len) 716 - return -EINVAL; 717 - 718 - buf_len = le32_to_cpu(*(__le32 *)src); 719 - if (buf_len != dst_len) 720 - return -EINVAL; 721 - 722 - memcpy(dst, src + sizeof(u32), dst_len); 723 - return 0; 724 - } 725 - 726 - static void handle_poolop_reply(struct ceph_mon_client *monc, 727 - struct ceph_msg *msg) 728 - { 729 - struct ceph_mon_generic_request *req; 730 - struct ceph_mon_poolop_reply *reply = msg->front.iov_base; 731 - u64 tid = le64_to_cpu(msg->hdr.tid); 732 - 733 - if (msg->front.iov_len < sizeof(*reply)) 734 - goto bad; 735 - dout("handle_poolop_reply %p tid %llu\n", msg, tid); 736 - 737 - mutex_lock(&monc->mutex); 738 - req = __lookup_generic_req(monc, tid); 739 - if (req) { 740 - if (req->buf_len && 741 - get_poolop_reply_buf(msg->front.iov_base + sizeof(*reply), 742 - msg->front.iov_len - sizeof(*reply), 743 - req->buf, req->buf_len) < 0) { 744 - mutex_unlock(&monc->mutex); 745 - goto bad; 746 - } 747 - req->result = le32_to_cpu(reply->reply_code); 748 - get_generic_request(req); 749 - } 750 - mutex_unlock(&monc->mutex); 751 - if (req) { 752 - complete(&req->completion); 753 - put_generic_request(req); 754 - } 755 - return; 756 - 757 - bad: 758 - pr_err("corrupt generic reply, tid %llu\n", tid); 759 - ceph_msg_dump(msg); 760 - } 761 - 762 - /* 763 - * Do a synchronous pool op. 764 - */ 765 - static int do_poolop(struct ceph_mon_client *monc, u32 op, 766 - u32 pool, u64 snapid, 767 - char *buf, int len) 768 - { 769 - struct ceph_mon_generic_request *req; 770 - struct ceph_mon_poolop *h; 771 - int err; 772 - 773 - req = kzalloc(sizeof(*req), GFP_NOFS); 774 - if (!req) 775 - return -ENOMEM; 776 - 777 - kref_init(&req->kref); 778 - req->buf = buf; 779 - req->buf_len = len; 780 - init_completion(&req->completion); 781 - 782 - err = -ENOMEM; 783 - req->request = ceph_msg_new(CEPH_MSG_POOLOP, sizeof(*h), GFP_NOFS, 784 - true); 785 - if (!req->request) 786 - goto out; 787 - req->reply = ceph_msg_new(CEPH_MSG_POOLOP_REPLY, 1024, GFP_NOFS, 788 - true); 789 - if (!req->reply) 790 - goto out; 791 - 792 - /* fill out request */ 793 - req->request->hdr.version = cpu_to_le16(2); 794 - h = req->request->front.iov_base; 795 - h->monhdr.have_version = 0; 796 - h->monhdr.session_mon = cpu_to_le16(-1); 797 - h->monhdr.session_mon_tid = 0; 798 - h->fsid = monc->monmap->fsid; 799 - h->pool = cpu_to_le32(pool); 800 - h->op = cpu_to_le32(op); 801 - h->auid = 0; 802 - h->snapid = cpu_to_le64(snapid); 803 - h->name_len = 0; 804 - 805 - err = do_generic_request(monc, req); 806 - 807 - out: 808 - kref_put(&req->kref, release_generic_request); 809 - return err; 810 - } 811 - 812 - int ceph_monc_create_snapid(struct ceph_mon_client *monc, 813 - u32 pool, u64 *snapid) 814 - { 815 - return do_poolop(monc, POOL_OP_CREATE_UNMANAGED_SNAP, 816 - pool, 0, (char *)snapid, sizeof(*snapid)); 817 - 818 - } 819 - EXPORT_SYMBOL(ceph_monc_create_snapid); 820 - 821 - int ceph_monc_delete_snapid(struct ceph_mon_client *monc, 822 - u32 pool, u64 snapid) 823 - { 824 - return do_poolop(monc, POOL_OP_CREATE_UNMANAGED_SNAP, 825 - pool, snapid, NULL, 0); 826 - 827 - } 828 708 829 709 /* 830 710 * Resend pending generic requests. ··· 988 1112 handle_get_version_reply(monc, msg); 989 1113 break; 990 1114 991 - case CEPH_MSG_POOLOP_REPLY: 992 - handle_poolop_reply(monc, msg); 993 - break; 994 - 995 1115 case CEPH_MSG_MON_MAP: 996 1116 ceph_monc_handle_map(monc, msg); 997 1117 break; ··· 1026 1154 case CEPH_MSG_MON_SUBSCRIBE_ACK: 1027 1155 m = ceph_msg_get(monc->m_subscribe_ack); 1028 1156 break; 1029 - case CEPH_MSG_POOLOP_REPLY: 1030 1157 case CEPH_MSG_STATFS_REPLY: 1031 1158 return get_generic_reply(con, hdr, skip); 1032 1159 case CEPH_MSG_AUTH_REPLY: