Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755488AbbGFMbb (ORCPT ); Mon, 6 Jul 2015 08:31:31 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:58155 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754646AbbGFMb0 (ORCPT ); Mon, 6 Jul 2015 08:31:26 -0400 X-AuditID: cbfee61a-f79516d000006302-14-559a751dbf0f From: Chao Yu To: Jaegeuk Kim Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] f2fs: restrict multimedia filename Date: Mon, 06 Jul 2015 20:30:40 +0800 Message-id: <004801d0b7e7$aca6df10$05f49d30$@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: AdC32nMpBrc0KJjrT6Cl1QJqXCN0DA== Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrOLMWRmVeSWpSXmKPExsVy+t9jQV3Z0lmhBo27NCyerJ/FbHFpkbvF 5V1z2ByYPTat6mTz2L3gM5PH501yAcxRXDYpqTmZZalF+nYJXBmrt5UUPOOtmHy5k72BcQl3 FyMHh4SAicS8VfVdjJxAppjEhXvr2boYuTiEBKYzSnzuaWWGcF4xSryZc5sFpIpNQEViecd/ JhBbBMg+tOgyO4jNLOAh0djxnRXEFhYwl1h78wlYDYuAqsSStzfAangFLCWez+6DsgUlfky+ xwLRqyWxfudxJghbXmLzmrfMEBcpSOw4+5oRYpeexNwze9kgasQlNh65xTKBUWAWklGzkIya hWTULCQtCxhZVjGKphYkFxQnpeca6hUn5haX5qXrJefnbmIEB+8zqR2MKxssDjEKcDAq8fBu qJsZKsSaWFZcmXuIUYKDWUmEt9pnVqgQb0piZVVqUX58UWlOavEhRmkOFiVx3pP5PqFCAumJ JanZqakFqUUwWSYOTqkGRr6fLycKeD3hfvrq9v6JcYd2ybYLMrOd2sRXxt3d+20i+9YZ3bLH /6XF2kyue1OlbbeWIzaP/ZyYT3uamkd/f0fXPOVOKXb5r5f4NWd9nnR4X1XRbvktfS9WZz2Q m3HPfUddk2GJkdO30AdtMfZWXPFfbWzybSW/PQgsLt7r6Hp+z5Q+7+LzSizFGYmGWsxFxYkA EGNI3VoCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1954 Lines: 62 When testing with fs_mark, some blocks were written out as cold data which were mixed with warm data, resulting in splitting more bios. This is because fs_mark will create file with random filename as below: 559551ee~~~~~~~~15Z29OCC05JCKQP60JQ42MKV 559551ee~~~~~~~~NZAZ6X8OA8LHIIP6XD0L58RM 559551ef~~~~~~~~B15YDSWAK789HPSDZKYTW6WM 559551f1~~~~~~~~2DAE5DPS79785BUNTFWBEMP3 559551f1~~~~~~~~1MYDY0BKSQCJPI32Q8C514RM 559551f1~~~~~~~~YQOTMAOMN5CVRFOUNI026MP4 559551f3~~~~~~~~1WF42LPRTQJNPPGR3EINKMPE 559551f3~~~~~~~~8Y2NRK7CEPPAA02LY936PJPG They are regarded as cold file since their filename are ended with multimedia files' extension, but this should be wrong as we only match the extension of filename, not the whole one. In this patch, we try to fix the format of multimedia filename to: "filename + '.' + extension", then we set cold file only its filename matches the format. So after this change, it will reduce the probability we set the wrong cold file, also it helps a little for fs_mark's performance on f2fs. Signed-off-by: Chao Yu --- fs/f2fs/namei.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 38f6887..1d790fb 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -91,7 +91,14 @@ static int is_multimedia_file(const unsigned char *s, const char *sub) size_t slen = strlen(s); size_t sublen = strlen(sub); - if (sublen > slen) + /* + * filename format of multimedia file should be defined as: + * "filename + '.' + extension". + */ + if (slen < sublen + 2) + return 0; + + if (s[slen - sublen - 1] != '.') return 0; return !strncasecmp(s + slen - sublen, sub, sublen); -- 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/