From patchwork Wed Aug 21 07:02:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: majianpeng X-Patchwork-Id: 2847545 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5F9F39F271 for ; Wed, 21 Aug 2013 07:03:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E011F203E8 for ; Wed, 21 Aug 2013 07:03:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DDF0920397 for ; Wed, 21 Aug 2013 07:03:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752429Ab3HUHC4 (ORCPT ); Wed, 21 Aug 2013 03:02:56 -0400 Received: from mail-pd0-f175.google.com ([209.85.192.175]:32883 "EHLO mail-pd0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752318Ab3HUHCy (ORCPT ); Wed, 21 Aug 2013 03:02:54 -0400 Received: by mail-pd0-f175.google.com with SMTP id q10so57222pdj.6 for ; Wed, 21 Aug 2013 00:02:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:reply-to:subject:mime-version:message-id :content-type:content-transfer-encoding; bh=hf+mJop+FjXU0Bz9CnlBQDYYMx+0ueU27fzGpfwis1A=; b=1HgdX1ha2FX5sM2GOj4Q+Hroqj1c8N4d9LOmfm2RWXHvULsWyapxz9ZGgbC7jKe34T 6NAZfUpBSiaqrbBSI238cxqKL9BT4prGdB0tXMfZMutQTY3JUa9UixnttWjFH9GGdNI9 yCxH2jikWtEfk9dJWpl4IQLgBKJHE9NcYwqz7YTV2KHKOKHX9fqHhkQaw9RpzCJDWMIO aofVJ+hJqVUTxv+JMbfbJb1PinEt9WYtvYt33wb7s9Fhd0jO5SjCkaZ+09LWIO2dH2Ze Q45yOLkDL2s0ryPNdqaq52pPn0RFDSq5N6S53GlPAUqxqnZc0RG0sM0GkZMdWuvNTSU2 GTZQ== X-Received: by 10.66.251.1 with SMTP id zg1mr7764110pac.160.1377068573701; Wed, 21 Aug 2013 00:02:53 -0700 (PDT) Received: from majianpeng ([218.242.10.182]) by mx.google.com with ESMTPSA id z14sm6501957pbt.0.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 21 Aug 2013 00:02:52 -0700 (PDT) Date: Wed, 21 Aug 2013 15:02:51 +0800 From: majianpeng To: sage Cc: ceph-devel Reply-To: majianpeng Subject: [PATCH] ceph: allow sync_read/write return partial successed size of read/write. X-Priority: 3 X-GUID: B42DB1B9-59C3-43ED-B4BC-FE646D3705E1 X-Has-Attach: no X-Mailer: Foxmail 7.0.1.93[cn] Mime-Version: 1.0 Message-ID: <201308211502490443362@gmail.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MIME_BASE64_TEXT, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Sage: This patch based on my previous patch"ceph: fix bugs about handling short-read for sync read mode". I can't see this patch in ceph-client#testing.Maybe you forget it ? Thanks! Jianpeng Ma For sync_read/write, it may do multi stripe operations.If one of those met erro, we return the former successed size rather than a error value. There is a exception for write-operation met -EOLDSNAPC.If this occur,we retry the whole write again. Signed-off-by: Jianpeng Ma --- fs/ceph/file.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 1.8.1.2 diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 69c4669..dd525c5 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -373,7 +373,7 @@ more: goto more; } - if (ret >= 0) { + if (read > 0) { ret = read; /* did we bounce off eof? */ if (pos + left > inode->i_size) @@ -611,7 +611,8 @@ out: if (check_caps) ceph_check_caps(ceph_inode(inode), CHECK_CAPS_AUTHONLY, NULL); - } + } else if (ret != -EOLDSNAPC && written > 0) + ret = written; return ret; }