From patchwork Mon Dec 3 12:50:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongsheng Yang X-Patchwork-Id: 10709495 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 65E5913BF for ; Mon, 3 Dec 2018 12:56:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 538D12B408 for ; Mon, 3 Dec 2018 12:56:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4754A2B4AF; Mon, 3 Dec 2018 12:56:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8764F2B408 for ; Mon, 3 Dec 2018 12:56:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726552AbeLCM5D (ORCPT ); Mon, 3 Dec 2018 07:57:03 -0500 Received: from m50211.mail.qiye.163.com ([123.125.50.211]:22066 "EHLO m50211.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726519AbeLCM5C (ORCPT ); Mon, 3 Dec 2018 07:57:02 -0500 Received: from atest-guest.localdomain (unknown [218.94.118.90]) by smtp3 (Coremail) with SMTP id PdOowEDpa0CfJgVcOwAAAA--.14S4; Mon, 03 Dec 2018 20:50:40 +0800 (CST) From: Dongsheng Yang To: idryomov@gmail.com, sage@redhat.com, elder@kernel.org, jdillama@redhat.com Cc: dongsheng.yang@easystack.cn, ceph-devel@vger.kernel.org Subject: [PATCH 02/11] libceph: support op append Date: Mon, 3 Dec 2018 07:50:26 -0500 Message-Id: <1543841435-13652-3-git-send-email-dongsheng.yang@easystack.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1543841435-13652-1-git-send-email-dongsheng.yang@easystack.cn> References: <1543841435-13652-1-git-send-email-dongsheng.yang@easystack.cn> X-CM-TRANSID: PdOowEDpa0CfJgVcOwAAAA--.14S4 X-Coremail-Antispam: 1Uf129KBjvJXoWxWFW5AFW8Zry7JFW5Zw43Wrg_yoWrJFWUpF ZrA3yjyFW3Ja4xZrs7GFZ5t3yrJ3yvyF42qrWDKrs3Can3JrykZ3Z8Xr9Fgr1UZF4Fg348 CF1Y9r90qw1SvrDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0JbiOJrUUUUU= X-Originating-IP: [218.94.118.90] X-CM-SenderInfo: 5grqw2pkhqwhp1dqwq5hdv52pwdfyhdfq/1tbiHAASelpcg+P31gAAsz Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP we need to send append operation when we want to support journaling in kernel client. Signed-off-by: Dongsheng Yang --- net/ceph/osd_client.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index d23a9f8..ffc93ee 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -386,6 +386,7 @@ static void osd_req_op_data_release(struct ceph_osd_request *osd_req, case CEPH_OSD_OP_READ: case CEPH_OSD_OP_WRITE: case CEPH_OSD_OP_WRITEFULL: + case CEPH_OSD_OP_APPEND: ceph_osd_data_release(&op->extent.osd_data); break; case CEPH_OSD_OP_CALL: @@ -702,6 +703,7 @@ static void get_num_data_items(struct ceph_osd_request *req, /* request */ case CEPH_OSD_OP_WRITE: case CEPH_OSD_OP_WRITEFULL: + case CEPH_OSD_OP_APPEND: case CEPH_OSD_OP_SETXATTR: case CEPH_OSD_OP_CMPXATTR: case CEPH_OSD_OP_NOTIFY_ACK: @@ -787,13 +789,13 @@ void osd_req_op_extent_init(struct ceph_osd_request *osd_req, BUG_ON(opcode != CEPH_OSD_OP_READ && opcode != CEPH_OSD_OP_WRITE && opcode != CEPH_OSD_OP_WRITEFULL && opcode != CEPH_OSD_OP_ZERO && - opcode != CEPH_OSD_OP_TRUNCATE); + opcode != CEPH_OSD_OP_TRUNCATE && opcode != CEPH_OSD_OP_APPEND); op->extent.offset = offset; op->extent.length = length; op->extent.truncate_size = truncate_size; op->extent.truncate_seq = truncate_seq; - if (opcode == CEPH_OSD_OP_WRITE || opcode == CEPH_OSD_OP_WRITEFULL) + if (opcode == CEPH_OSD_OP_WRITE || opcode == CEPH_OSD_OP_WRITEFULL || opcode == CEPH_OSD_OP_APPEND) payload_len += length; op->indata_len = payload_len; @@ -815,7 +817,7 @@ void osd_req_op_extent_update(struct ceph_osd_request *osd_req, BUG_ON(length > previous); op->extent.length = length; - if (op->op == CEPH_OSD_OP_WRITE || op->op == CEPH_OSD_OP_WRITEFULL) + if (op->op == CEPH_OSD_OP_WRITE || op->op == CEPH_OSD_OP_WRITEFULL || op->op == CEPH_OSD_OP_APPEND) op->indata_len -= previous - length; } EXPORT_SYMBOL(osd_req_op_extent_update); @@ -837,7 +839,7 @@ void osd_req_op_extent_dup_last(struct ceph_osd_request *osd_req, op->extent.offset += offset_inc; op->extent.length -= offset_inc; - if (op->op == CEPH_OSD_OP_WRITE || op->op == CEPH_OSD_OP_WRITEFULL) + if (op->op == CEPH_OSD_OP_WRITE || op->op == CEPH_OSD_OP_WRITEFULL || op->op == CEPH_OSD_OP_APPEND) op->indata_len -= offset_inc; } EXPORT_SYMBOL(osd_req_op_extent_dup_last); @@ -977,6 +979,7 @@ static u32 osd_req_encode_op(struct ceph_osd_op *dst, case CEPH_OSD_OP_READ: case CEPH_OSD_OP_WRITE: case CEPH_OSD_OP_WRITEFULL: + case CEPH_OSD_OP_APPEND: case CEPH_OSD_OP_ZERO: case CEPH_OSD_OP_TRUNCATE: dst->extent.offset = cpu_to_le64(src->extent.offset); @@ -1070,7 +1073,7 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc, BUG_ON(opcode != CEPH_OSD_OP_READ && opcode != CEPH_OSD_OP_WRITE && opcode != CEPH_OSD_OP_ZERO && opcode != CEPH_OSD_OP_TRUNCATE && - opcode != CEPH_OSD_OP_CREATE && opcode != CEPH_OSD_OP_DELETE); + opcode != CEPH_OSD_OP_CREATE && opcode != CEPH_OSD_OP_DELETE && opcode != CEPH_OSD_OP_APPEND); req = ceph_osdc_alloc_request(osdc, snapc, num_ops, use_mempool, GFP_NOFS); @@ -1944,6 +1947,7 @@ static void setup_request_data(struct ceph_osd_request *req) /* request */ case CEPH_OSD_OP_WRITE: case CEPH_OSD_OP_WRITEFULL: + case CEPH_OSD_OP_APPEND: WARN_ON(op->indata_len != op->extent.length); ceph_osdc_msg_data_add(request_msg, &op->extent.osd_data);