Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp5175705pxb; Tue, 28 Sep 2021 12:09:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWDLlLpxMmAXNunybpB513u+GdJyvTFMQqsSsVOsUBljEbVDOpI1Op+fQ3KYHUSsj8cDGu X-Received: by 2002:a63:5a41:: with SMTP id k1mr6034226pgm.17.1632856165390; Tue, 28 Sep 2021 12:09:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632856165; cv=none; d=google.com; s=arc-20160816; b=aGx5vO4B0zCmd9MkbLuGdnkrBP2cTJjpP7WkGTUk3DxHD/a4rlUhN0ARXIYrtIpvkz nEcAZ1h5Nvm6W0dxH6G8qoDKZq7i0cWcbKHn+ibRB1qcgs/YNMrsdLpK889jZ/FLrPy8 jd0q7MzoiPXU1KiahdaGn5hhatdilCznSyTHLYI8Wl6XU1tsJ5hf3QcaQLvrvNc7LZf3 AuLOy/HDUV81/cDiExL6bWJMyKKzgUPHJuKzJj/gPvLn7rXXTlXzijF0G7OfxQeXrraa IpnmPsx86K8ZihWu1s0dNNQ8mjRDLzSDp2Psxu6340ImOXTXhO8OYpKfVR7M4Zm/69Ti KpdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=gwrgcAG6L2mKfMkvvNxOZ6Aix+kWpPT7+CFcHGZ+OII=; b=LapaSpkFdsOvgnOvi2hoRr94ezG1eU0410g4BRKQYuEgqPt7Uq+ItLbBhbX3HoKADa cGoACN96ky97rIiIZnmCJlKnwmfLmJaT8NNMXNiC3WFuh/8ffSdsH3rvoPgT5r1RUf4u H7R03hSeQhHcJ22Bqh80giQ4wWalqxSv1viHkoYILVH3auEniz0sfjieGAB+nR/N5/iq 64mNYrEZPKJ/RULA3JPTUVjWufPSJLpGdZlVTqhgQLMzY98i2EExHt573ieHZf0p5zi7 WlXZV+KaiHUkFkL+111c4APdb3sQtTzFAPQKePUZuNv/X+nnu0fPHkiQ+/oLn67OpMMZ H87g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TnpH9gDV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id y15si11299166pll.228.2021.09.28.12.09.07; Tue, 28 Sep 2021 12:09:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TnpH9gDV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S242253AbhI1TJ4 (ORCPT + 99 others); Tue, 28 Sep 2021 15:09:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:33994 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242155AbhI1TJz (ORCPT ); Tue, 28 Sep 2021 15:09:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D1A6A61209; Tue, 28 Sep 2021 19:08:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632856095; bh=fBHQNVYni7drO15VqxNgNsWT8o0vf2pPho5LYOalSRI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TnpH9gDVSVlXr0aZrYOoY3tVtnsZ1nVyg0JOOHTM9WoJ42V+Z87TT2zYROFgX7Nky izF1Uue4tgAx2q0ZiX/lBTl2Exqnfboptzkr9jSgKjnJ2AolissG/LAekzxyjXEbjW 7deKIW9u2yhceCfxFyoMKyMYYSef1kYxm6qV3iHzevty4bRfh9U5Y3QEK2VimaT8UH W9ZLyiRY5DK1Jf60+hkXgl3WKB0DdoY4s5PTTSHorUZ2ycbn8Dv+UiOLPlBcg/x6Ym qups0fDbeEQwfR/8gjbpAUvCSeOhChmwRICo6Cl1FwwseQ8nZq9Mup/qIFPhdRDOEI cW6hNOKH2dGYA== Date: Tue, 28 Sep 2021 12:08:14 -0700 From: Jaegeuk Kim To: Chao Yu Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: [PATCH] f2fs: skip f2fs_preallocate_blocks() for overwrite case Message-ID: References: <20210928151911.11189-1-chao@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210928151911.11189-1-chao@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/28, Chao Yu wrote: > In f2fs_file_write_iter(), let's use f2fs_overwrite_io() to > check whethere it is overwrite case, for such case, we can skip > f2fs_preallocate_blocks() in order to avoid f2fs_do_map_lock(), > which may be blocked by checkpoint() potentially. > > Signed-off-by: Chao Yu > --- > fs/f2fs/file.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > index 13deae03df06..51fecb2f4db5 100644 > --- a/fs/f2fs/file.c > +++ b/fs/f2fs/file.c > @@ -4321,6 +4321,10 @@ static ssize_t f2fs_file_write_iter(struct kiocb *iocb, struct iov_iter *from) > preallocated = true; > target_size = iocb->ki_pos + iov_iter_count(from); > > + if (f2fs_overwrite_io(inode, iocb->ki_pos, > + iov_iter_count(from))) > + goto write; This calls f2fs_map_blocks() which can be duplicate, if it's not the overwirte case. Do we have other benefit? > + > err = f2fs_preallocate_blocks(iocb, from); > if (err) { > out_err: > -- > 2.32.0