Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753545AbbHSLLH (ORCPT ); Wed, 19 Aug 2015 07:11:07 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:35876 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753005AbbHSLLE (ORCPT ); Wed, 19 Aug 2015 07:11:04 -0400 X-AuditID: cbfee61a-f79a06d000005c6f-21-55d464460574 From: Chao Yu To: Jaegeuk Kim Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH 2/9] f2fs: avoid unneeded initializing when converting inline dentry Date: Wed, 19 Aug 2015 19:10:19 +0800 Message-id: <017601d0da6f$bcb555d0$36200170$@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: AdDabtma4A33vbRjRhm4skAPq1HOkA== Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrFLMWRmVeSWpSXmKPExsVy+t9jAV23lCuhBo9+6lk8WT+L2eLSIneL y7vmsDkwe2xa1cnmsXvBZyaPz5vkApijuGxSUnMyy1KL9O0SuDKu3LUpmMNf8fLvAvYGxgc8 XYycHBICJhJnX+xngrDFJC7cW8/WxcjFISSwlFGi+ecLRgjnFaPE+seTmEGq2ARUJJZ3/Afr EAGyDy26zA5iMwt4SDR2fGcFsYUFwiROP/8AVs8ioCrxbdopIJuDg1fAUuLaBjmQMK+AoMSP yfdYIFq1JNbvPM4EYctLbF7zlhniIAWJHWdfM0Ks0pP4+Pwl1CpxiY1HbrFMYBSYhWTULCSj ZiEZNQtJywJGllWMEqkFyQXFSem5hnmp5XrFibnFpXnpesn5uZsYwSH8TGoH48Fd7ocYBTgY lXh4Z2y7HCrEmlhWXJl7iFGCg1lJhPdWwpVQId6UxMqq1KL8+KLSnNTiQ4zSHCxK4ryyGzaH CgmkJ5akZqemFqQWwWSZODilGhh3P9n4d4uLl9aNteUVP7Z+Xh3wU3bnjAhVFZnNT3VP9HkL L1260PNef8azHz3bT99ti5z0PUPhZI3Z4aZ3e1JDUrf3VHScNJ5+4eRv1QPzS/lnHMvcZ/Tm eun0nXJy8+a8TGZXzpvH+3uW142Cg+6bvrNF3DBuEvuSJNFbxtW3Y7ldjINzb5mEEktxRqKh FnNRcSIARB2PwF0CAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2141 Lines: 57 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 --- fs/f2fs/inline.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c index 79d18d5..e4da0d7 100644 --- a/fs/f2fs/inline.c +++ b/fs/f2fs/inline.c @@ -384,17 +384,30 @@ 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); + /* + * reserved space size of inline dentry is larger than the one of + * regular dentry, here we just copy with the size of reserved space + * in regular dentry. + */ + memcpy(dentry_blk->reserved, inline_dentry->reserved, SIZE_OF_RESERVED); memcpy(dentry_blk->dentry, inline_dentry->dentry, sizeof(struct f2fs_dir_entry) * NR_INLINE_DENTRY); + memset(dentry_blk->dentry + NR_INLINE_DENTRY, 0, + sizeof (struct f2fs_dir_entry) * + (NR_DENTRY_IN_BLOCK - NR_INLINE_DENTRY)); memcpy(dentry_blk->filename, inline_dentry->filename, NR_INLINE_DENTRY * F2FS_SLOT_LEN); + memset(&dentry_blk->filename[NR_INLINE_DENTRY][0], 0, + F2FS_SLOT_LEN * (NR_DENTRY_IN_BLOCK - NR_INLINE_DENTRY)); kunmap_atomic(dentry_blk); SetPageUptodate(page); -- 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/