From patchwork Thu Jun 27 07:56:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: majianpeng X-Patchwork-Id: 2790471 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D6BCBC0AB1 for ; Thu, 27 Jun 2013 07:56:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 14EAF201F5 for ; Thu, 27 Jun 2013 07:56:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 95CBF201F0 for ; Thu, 27 Jun 2013 07:56:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752823Ab3F0H4H (ORCPT ); Thu, 27 Jun 2013 03:56:07 -0400 Received: from mail-pd0-f173.google.com ([209.85.192.173]:53709 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752648Ab3F0H4G (ORCPT ); Thu, 27 Jun 2013 03:56:06 -0400 Received: by mail-pd0-f173.google.com with SMTP id v14so237768pde.4 for ; Thu, 27 Jun 2013 00:56:05 -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:x-priority:x-guid:x-has-attach :x-mailer:mime-version:message-id:content-type :content-transfer-encoding; bh=FB+EClJEBQnPrYCB1ZKcdxxxB4LFyCVs/S3jcu3KoTw=; b=iaFwCIbsa7BtHLZufADuxSqvKkls0plitPsQCHftLOR8ZXfzon4A+xS+bQ3JhKsQTS 3lxkVZulWaxHuPxRBeOuhSnynbCi2M8l+bAV1cycMFVBxGTiVlgvw+1XDJZ35Dvy+iKC fy/9aIKlNebzqAQp3upjdm0v8yPjpAm2h1EMz5VrnIU4f6a7W0AXetSebmxDll/bKO09 mFWLkA2h37Fp43CEABtbUEu4TKb8VBdINT5yLotYJz4D1tw/bqTotx0FB45qk4M8BIaT WRXNyVLiWW1dUVqq3pH8XRud4piQ7aY0SzF15rhL6PzXd/COTrNsc3ZK59/qcxqGLAoJ Y8OQ== X-Received: by 10.66.232.42 with SMTP id tl10mr4631643pac.159.1372319765495; Thu, 27 Jun 2013 00:56:05 -0700 (PDT) Received: from majianpeng ([218.242.10.182]) by mx.google.com with ESMTPSA id pe9sm2012966pbc.35.2013.06.27.00.56.01 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 27 Jun 2013 00:56:04 -0700 (PDT) Date: Thu, 27 Jun 2013 15:56:06 +0800 From: majianpeng To: sage Cc: ceph-devel , linux-kernel Reply-To: majianpeng Subject: [PATCH] ceph: Don't use ceph-sync-mode for synchronous-fs. X-Priority: 3 X-GUID: 0BB5DB46-89B9-41E2-A7E8-27EFEEF5D5B7 X-Has-Attach: no X-Mailer: Foxmail 7.0.1.90[en] Mime-Version: 1.0 Message-ID: <201306271556037311581@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=-8.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable 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 At now for synchronous-fs, all write-operations use ceph_sync_mode. But for the file which opened with O_SYNC, it don't use sync_mode. The behaviour of them should be the same. For fs which mounted using '-o sync', it want all I/O to the filesystem should be done synchronously.But the ceph-sync-mode don't be suitful for.For example,using ceph-sync-mode the content of file don't have in memory.This will cause the following read only from osd rather than memory. Signed-off-by: Jianpeng Ma --- fs/ceph/file.c | 2 -- 1 file changed, 2 deletions(-) -- 1.8.1.2 diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 656e169..44670ad 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -659,7 +659,6 @@ again: if ((got & (CEPH_CAP_FILE_CACHE|CEPH_CAP_FILE_LAZYIO)) == 0 || (iocb->ki_filp->f_flags & O_DIRECT) || - (inode->i_sb->s_flags & MS_SYNCHRONOUS) || (fi->flags & CEPH_F_SYNC)) /* hmm, this isn't really async... */ ret = ceph_sync_read(filp, base, len, ppos, &checkeof); @@ -764,7 +763,6 @@ retry_snap: if ((got & (CEPH_CAP_FILE_BUFFER|CEPH_CAP_FILE_LAZYIO)) == 0 || (iocb->ki_filp->f_flags & O_DIRECT) || - (inode->i_sb->s_flags & MS_SYNCHRONOUS) || (fi->flags & CEPH_F_SYNC)) { mutex_unlock(&inode->i_mutex); written = ceph_sync_write(file, iov->iov_base, count,