Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1152219ybl; Thu, 23 Jan 2020 14:42:22 -0800 (PST) X-Google-Smtp-Source: APXvYqzo+n/af/w2oe4hkrTARYqYlznN5MpOBgMV/pej5xYPp5ZBtsjc+sEnvn+0kxCHlcFhtSf4 X-Received: by 2002:a05:6830:231d:: with SMTP id u29mr531842ote.185.1579819341858; Thu, 23 Jan 2020 14:42:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579819341; cv=none; d=google.com; s=arc-20160816; b=f5k8MjzkYvCNMC+AAspiQxDp2j25IZ/o+w3Ps6LJtGF2Qt1I8ifN2thB9kXDVmbS6Q IWGpFW9Dt+YdZRbsqUM8H52OhZJuEjfSJItldCleNBBBtQUFzmy+jyPnuf3CJD34FhbE by2XkG5byZhvb+UcPgID4ybCP35VbCr5LSThOso9I+8Je1HWdCecvys9ob0SjbijbGvs srlADXIKkKueS8+DyKO3e/jlAf2J6cvEW/ysZ3MmFEYVrZTY5JdRKuQFgD+68u9/3vku ZnKC7mIEdmuYlJtGftfeIvC/BIM0mJ8+bAhBM2y3v1L0ZNJ/JOYDw9i7AMvAMI6/8+oF Z/FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=6GCer35gNnEOSbjoRzEgrk7stT4nnLz4VTXwRDCZIm0=; b=SWQ/y4AJBHD+LhszKpsonnDXBDq0sMyLII6UTvBa2LSe1FU8D2a7gqP6d/x3u5jWbl H2TKiGPpa8e8zFdzYWcD44t1yC5xcksBlkgoNECdxS9+2jdc+T4NO9DWmYEzYuINvFEQ 0rsX7i+ymiPpp8bvmFLW5Tr9horloKdAkEaP5dLhURZw07cVMz9pSN7W04mnN2SvGT5S 2V137TxnUzrZtcFDPHAy5x8y/RSbBnnxDPAjMW4ncQTSOKjIFiL2fyTdYzANChjr07oO iXcH9KvuwkTol/yOSCiG3ZHxKHNTRRSQpu+AY7sxk6m9sZ8Z8ZAghMRDLd42/VBywmDr L8qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mgpDd2lJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 5si1516693oil.188.2020.01.23.14.42.09; Thu, 23 Jan 2020 14:42:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mgpDd2lJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729152AbgAWWS5 (ORCPT + 99 others); Thu, 23 Jan 2020 17:18:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:57738 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727312AbgAWWS4 (ORCPT ); Thu, 23 Jan 2020 17:18:56 -0500 Received: from localhost (unknown [104.132.0.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0552C21734; Thu, 23 Jan 2020 22:18:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579817936; bh=1QEQIO8BWAIq1V8e658QCqVX3p3sFtysjrQ4cMkD+No=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mgpDd2lJHJTZW8xM52EL06pd4wP+yn6acWkQWTFTugidxxyxwfqjKHuxvzYw5Jbb3 woOv9G0EsnPNFw7/tdtd4XYA2EZFAkoQmds+tifpbO26fY2dPu9UzFt3cIGJAMVYav 3b9rYtyiWBdcw/Z6QIc6j0EW1arOYWgIxl3HtnRg= Date: Thu, 23 Jan 2020 14:18:55 -0800 From: Jaegeuk Kim To: Chao Yu Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, chao@kernel.org Subject: Re: [PATCH] f2fs: fix to force keeping write barrier for strict fsync mode Message-ID: <20200123221855.GA7917@jaegeuk-macbookpro.roam.corp.google.com> References: <20200120100045.70210-1-yuchao0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200120100045.70210-1-yuchao0@huawei.com> User-Agent: Mutt/1.8.2 (2017-04-18) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/20, Chao Yu wrote: > If barrier is enabled, for strict fsync mode, we should force to > use atomic write semantics to avoid data corruption due to no > barrier support in lower device. > > Signed-off-by: Chao Yu > --- > fs/f2fs/file.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > index 86ddbb55d2b1..c9dd45f82fbd 100644 > --- a/fs/f2fs/file.c > +++ b/fs/f2fs/file.c > @@ -241,6 +241,13 @@ static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end, > }; > unsigned int seq_id = 0; > > + /* > + * for strict fsync mode, force to keep atomic write sematics to avoid > + * data corruption if lower device doesn't support write barrier. > + */ > + if (!atomic && F2FS_OPTION(sbi).fsync_mode == FSYNC_MODE_STRICT) > + atomic = true; This allows to relax IO ordering and cache flush. I'm not sure that's what you want to do here for strict mode. > + > if (unlikely(f2fs_readonly(inode->i_sb) || > is_sbi_flag_set(sbi, SBI_CP_DISABLED))) > return 0; > -- > 2.18.0.rc1