Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754143AbbLADhA (ORCPT ); Mon, 30 Nov 2015 22:37:00 -0500 Received: from mailout1.samsung.com ([203.254.224.24]:50731 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752698AbbLADg7 (ORCPT ); Mon, 30 Nov 2015 22:36:59 -0500 X-AuditID: cbfee61b-f793c6d00000236c-68-565d15d80864 From: Chao Yu To: Jaegeuk Kim Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH] f2fs: fix to convert inline inode in ->setattr Date: Tue, 01 Dec 2015 11:36:16 +0800 Message-id: <000001d12be9$87054960$950fdc20$@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: AdEr6Ory1nu1XYS9SXarrGRjUuOGzA== Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrDLMWRmVeSWpSXmKPExsVy+t9jQd0borFhBk+OmVg8WT+L2eLSIneL y7vmsDkwe2xa1cnmsXvBZyaPz5vkApijuGxSUnMyy1KL9O0SuDLuzn/JWLCCs+JMcytzA+MO 9i5GTg4JAROJU3emsEDYYhIX7q1n62Lk4hASmMUocW3NVijnFaPEmj1z2UCq2ARUJJZ3/GcC sUWA7EOLLoNNYhbwkGjs+M4KYgsL2Ets+3uPGcRmEVCVWLBoGlgvr4ClxO2lG5kgbEGJH5Pv sUD0akms33mcCcKWl9i85i0zxEUKEjvOvmaE2KUnsWrKKqhd4hIbj9ximcAIdCbCqFlIRs1C MmoWkpYFjCyrGCVSC5ILipPSc43yUsv1ihNzi0vz0vWS83M3MYLD+Jn0DsbDu9wPMQpwMCrx 8B5YFRMmxJpYVlyZe4hRgoNZSYR39W+gEG9KYmVValF+fFFpTmrxIUZpDhYlcd59lyLDhATS E0tSs1NTC1KLYLJMHJxSDYxKcq+jRUtad25Z1SWR7WaypkmThedI617J+1kP/SWCF8+88EXm fcwjpl2MnpviZ09kqv624lOAwJ6md7X9Dnduz8m/rHNKplRadu/EyRXtAg9XPttqaspabrRO 4nBi+fujEdr1cZ3NJ5o3z7IuX77zZn7hn3n7Nz28Krl8QrpZbPbhmzwzvQ2VWIozEg21mIuK EwETZBoTXwIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1400 Lines: 42 In commit 3c4541452748 ("f2fs: do not trim preallocated blocks when truncating after i_size"), in order to follow the regulation: "truncate(x) where x > i_size will not trim all blocks past i_size." like other file systems, in ->setattr we invoked truncate_setsize instead of f2fs_truncate to avoid unneeded block trimming in such case, but forgot to call f2fs_convert_inline_inode keep consistency of inline data conversion rule. This patch fixes to convert inline data if necessary. Signed-off-by: Chao Yu --- fs/f2fs/file.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 96e4e04..a018ed3 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -686,6 +686,14 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr) * larger than i_size. */ truncate_setsize(inode, attr->ia_size); + + /* should convert inline inode here */ + if (f2fs_has_inline_data(inode) && + !f2fs_may_inline_data(inode)) { + err = f2fs_convert_inline_inode(inode); + if (err) + return err; + } inode->i_mtime = inode->i_ctime = CURRENT_TIME; } } -- 2.6.3 -- 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/