Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933529AbbHXJhT (ORCPT ); Mon, 24 Aug 2015 05:37:19 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:38426 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932572AbbHXJhP (ORCPT ); Mon, 24 Aug 2015 05:37:15 -0400 X-AuditID: cbfee61b-f79706d000001b96-00-55dae5c9f40b From: Chao Yu To: Jaegeuk Kim Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/9] f2fs: avoid unneeded initializing when converting inline dentry Date: Mon, 24 Aug 2015 17:36:25 +0800 Message-id: <001801d0de50$74c630c0$5e529240$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: AdDeT/x0KTkT2agIRgm0e5q0KHu5Sg== Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrDLMWRmVeSWpSXmKPExsVy+t9jQd2TT2+FGuy9KmnxZP0sZotLi9wt Lu+aw+bA7LFpVSebx+4Fn5k8Pm+SC2CO4rJJSc3JLEst0rdL4Mq4/qqXrWAyb8Wf5guMDYwf uboYOTkkBEwkvj6dwwRhi0lcuLeerYuRi0NIYBajxPOPX5kgnFeMEr+OnGcFqWITUJFY3vEf rEMEyD606DI7iM0s4CHR2PEdrEZYIFJi99KNzCA2i4CqxIcFn1hAbF4BS4lXhxZB2YISPybf Y4Ho1ZJYv/M4E4QtL7F5zVtmiIsUJHacfc0IsUtP4m/3HagacYmNR26xTGAEOhNh1Cwko2Yh GTULScsCRpZVjBKpBckFxUnpuUZ5qeV6xYm5xaV56XrJ+bmbGMFh/Ex6B+PhXe6HGAU4GJV4 eBksb4UKsSaWFVfmHmKU4GBWEuFVenkzVIg3JbGyKrUoP76oNCe1+BCjNAeLkjivvsmmUCGB 9MSS1OzU1ILUIpgsEwenVAOjne2ycjvVaK0/MjyTJ83dF59w+luIv2xqT6r9nR8ZX4K5LW98 mawUPF0ikmXeJ6frPyQVzNwW7p2/P+PrzRmOSt9FS5YwBn8Wi9514se/LbY7J0ovYdj45Iv6 nsAmxwDZ6sr7rUrPXgko5szI2SrhoRcgnPHoXtCaDS9PMPQ8fvPwTunTB0f/K7EUZyQaajEX FScCAEDZDllfAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1883 Lines: 50 When converting inline dentry, we will zero out target dentry page before duplicating data of inline dentry into target page, it become overhead since inline dentry size is not small. So this patch tries to remove unneeded initializing in the space of target dentry page. Signed-off-by: Chao Yu --- v2: - remove unneeded memcpy/memset suggested by Jaegeuk Kim. fs/f2fs/inline.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c index 79d18d5..3d143be 100644 --- a/fs/f2fs/inline.c +++ b/fs/f2fs/inline.c @@ -384,13 +384,21 @@ static int f2fs_convert_inline_dir(struct inode *dir, struct page *ipage, goto out; f2fs_wait_on_page_writeback(page, DATA); - zero_user_segment(page, 0, PAGE_CACHE_SIZE); + zero_user_segment(page, MAX_INLINE_DATA, PAGE_CACHE_SIZE); dentry_blk = kmap_atomic(page); /* copy data from inline dentry block to new dentry block */ memcpy(dentry_blk->dentry_bitmap, inline_dentry->dentry_bitmap, INLINE_DENTRY_BITMAP_SIZE); + memset(dentry_blk->dentry_bitmap + INLINE_DENTRY_BITMAP_SIZE, 0, + SIZE_OF_DENTRY_BITMAP - INLINE_DENTRY_BITMAP_SIZE); + /* + * we do not need to zero out remainder part of dentry and filename + * field, since we have used bitmap for marking the usage status of + * them, besides, we can also ignore copying/zeroing reserved space + * of dentry block, because them haven't been used so far. + */ memcpy(dentry_blk->dentry, inline_dentry->dentry, sizeof(struct f2fs_dir_entry) * NR_INLINE_DENTRY); memcpy(dentry_blk->filename, inline_dentry->filename, -- 2.4.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/