From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BE9FC4332F for ; Mon, 11 Dec 2023 22:08:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345561AbjLKWIl (ORCPT ); Mon, 11 Dec 2023 17:08:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345555AbjLKWIh (ORCPT ); Mon, 11 Dec 2023 17:08:37 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 043DAC7 for ; Mon, 11 Dec 2023 14:08:44 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F5B2C433C9; Mon, 11 Dec 2023 22:08:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702332523; bh=iDewZAyJOxIOJgkget2tmiP/MAlk2VhzGLtGrH05aaw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=e3Z4OEv/bQCRGBikvcKo6n6zysKC22iBZJFAOV4Q5sUkus013tBJ2R7dpS9Ujl4uO DvNriuKSqj1YuhXUgGY6Jtt4HeNFcgNHmQwwpgVZIsj5Fq3bd2zHsv70PMaXpD18SW wbKRGGr4gxZwGDqGGevLKqD7qrWRAY8b1k5RAu9DemcVqULnc4P886MT9SIZJmICuf dqFPoIo0vzPFnXk5nyP7RYEZERK7yfNacfklZVIv0sj26HA8Fc11Or9XmCxWvlZCTk 6VEytIPHy3NkTea2rTsJlLy6R16JcyNBu8QYzplFVlo5aXqJLNKtVLvrO1a1WQk51R KkNf8E+5eMVag== Date: Mon, 11 Dec 2023 14:08:41 -0800 From: Jaegeuk Kim To: Chao Yu Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Eric Biggers Subject: Re: [PATCH 4/6] f2fs: don't set FI_PREALLOCATED_ALL for partial write Message-ID: References: <20231210113547.3412782-1-chao@kernel.org> <20231210113547.3412782-4-chao@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231210113547.3412782-4-chao@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/10, Chao Yu wrote: > In f2fs_preallocate_blocks(), if it is partial write in 4KB, it's not > necessary to call f2fs_map_blocks() and set FI_PREALLOCATED_ALL flag. > > Cc: Eric Biggers > Signed-off-by: Chao Yu > --- > fs/f2fs/file.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > index 5c2f99ada6be..1a3c29a9a6a0 100644 > --- a/fs/f2fs/file.c > +++ b/fs/f2fs/file.c > @@ -4561,13 +4561,14 @@ static int f2fs_preallocate_blocks(struct kiocb *iocb, struct iov_iter *iter, > return ret; > } > > - /* Do not preallocate blocks that will be written partially in 4KB. */ > map.m_lblk = F2FS_BLK_ALIGN(pos); > map.m_len = F2FS_BYTES_TO_BLK(pos + count); > - if (map.m_len > map.m_lblk) > - map.m_len -= map.m_lblk; > - else return 0; We just need the above? > - map.m_len = 0; > + > + /* Do not preallocate blocks that will be written partially in 4KB. */ > + if (map.m_len <= map.m_lblk) > + return 0; > + > + map.m_len -= map.m_lblk; > map.m_may_create = true; > if (dio) { > map.m_seg_type = f2fs_rw_hint_to_seg_type(inode->i_write_hint); > -- > 2.40.1