From patchwork Thu Aug 16 05:59:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongsheng Yang X-Patchwork-Id: 10566987 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 6DD795A4 for ; Thu, 16 Aug 2018 06:05:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5571C2AB89 for ; Thu, 16 Aug 2018 06:05:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 495922AB91; Thu, 16 Aug 2018 06:05:30 +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 584B22AB89 for ; Thu, 16 Aug 2018 06:05:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388824AbeHPJBb (ORCPT ); Thu, 16 Aug 2018 05:01:31 -0400 Received: from m50149.mail.qiye.163.com ([123.125.50.149]:13150 "EHLO m50149.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388779AbeHPJBb (ORCPT ); Thu, 16 Aug 2018 05:01:31 -0400 Received: from atest-guest.localdomain (unknown [218.94.118.90]) by smtp8 (Coremail) with SMTP id RdOowACHY5HTEnVbpKRVAA--.250S3; Thu, 16 Aug 2018 13:59:48 +0800 (CST) From: Dongsheng Yang To: idryomov@gmail.com, sage@redhat.com, elder@kernel.org, jdillama@redhat.com Cc: ceph-devel@vger.kernel.org, dongsheng.yang@easystack.cn Subject: [PATCH 1/4] libceph: support op append Date: Thu, 16 Aug 2018 01:59:29 -0400 Message-Id: <1534399172-27610-2-git-send-email-dongsheng.yang@easystack.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1534399172-27610-1-git-send-email-dongsheng.yang@easystack.cn> References: <1534399172-27610-1-git-send-email-dongsheng.yang@easystack.cn> X-CM-TRANSID: RdOowACHY5HTEnVbpKRVAA--.250S3 X-Coremail-Antispam: 1Uf129KBjvJXoWxCrWftFWrJw4xXr1xtw1UWrg_yoW5trW7pr ZrA3yjyFW3Ga4xZrs7WF95t3yrJ3yvyF42qrWDGrs3C3Z3Jry8Z3Z8Xr9rKw1UZF4Fg348 CF1Y9r90qw1SvrDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0J1jdgAUUUUU= X-Originating-IP: [218.94.118.90] X-CM-SenderInfo: 5grqw2pkhqwhp1dqwq5hdv52pwdfyhdfq/1tbifRykelrpNTcvKwAAsK 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 | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 34b5334..851ff9c 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -378,6 +378,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: @@ -712,13 +713,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; @@ -740,7 +741,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); @@ -762,7 +763,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); @@ -913,6 +914,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); @@ -998,7 +1000,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); @@ -1872,6 +1874,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(msg, &op->extent.osd_data); break;