Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964916AbbDPKea (ORCPT ); Thu, 16 Apr 2015 06:34:30 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:39116 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757143AbbDPKeT (ORCPT ); Thu, 16 Apr 2015 06:34:19 -0400 X-AuditID: cbfee61b-f79536d000000f1f-e6-552f9022ecbf From: Chao Yu To: "'Jaegeuk Kim'" Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net References: <1429169445-18306-1-git-send-email-jaegeuk@kernel.org> In-reply-to: <1429169445-18306-1-git-send-email-jaegeuk@kernel.org> Subject: RE: [f2fs-dev] [PATCH 1/3] f2fs: flush symlink path to avoid broken symlink after POR Date: Thu, 16 Apr 2015 18:33:29 +0800 Message-id: <000001d07830$e0787b60$a1697220$@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: AQG9nu63lJFClWjASiWYRB5pyv7JdZ11IIvA Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrELMWRmVeSWpSXmKPExsVy+t9jQV2lCfqhBndXq1k8WT+L2eLSIneL PXtPslhc3jWHzYHFY9OqTjaP3Qs+M3l83iQXwBzFZZOSmpNZllqkb5fAlfH4zAvmgj0iFctb FzA3ML4U6GJk55AQMJG4W9nFyAlkiUlcuLeerYuRi0NIYDqjxNbuGawQzitGiVO/O9lBqtgE VCSWd/xnArFFBNQkevdNAbOZBTIlJvS/AKsREnCSuNvVxQxicwo4S3w/sp2xi5GDQ1ggQeLM S2sQk0VAVWLlzTCQCl4BS4ld//pYIWxBiR+T77FATNSSWL/zONR0eYnNa94yQ9ypILHj7GtG iAuMJM7snskMUSMusfHILZYJjEKzkIyahWTULCSjZiFpWcDIsopRNLUguaA4KT3XSK84Mbe4 NC9dLzk/dxMjOOSfSe9gXNVgcYhRgINRiYf3R4p+qBBrYllxZe4hRgkOZiUR3r5eoBBvSmJl VWpRfnxRaU5q8SFGaQ4WJXHeObpyoUIC6YklqdmpqQWpRTBZJg5OqQbGrY7vyuRCVZglpl2W ehDJL+0c13+RP8raY1vai0a1jzqMH//84ZqoN32lCA+XnkQvR3pl0aHP8cHicXPW/ez+ufF7 5GLX5zvduJ2mbe2NXzOxW5Zt2ssJv3euuqk7bQ2Dy80TZkIbghI+eYkbOEi+b9Wx8Y98qtUn VH4+4RPvHLV3yw9YLZJWYinOSDTUYi4qTgQAdovbqHUCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2794 Lines: 76 Hi Jaegeuk, > -----Original Message----- > From: Jaegeuk Kim [mailto:jaegeuk@kernel.org] > Sent: Thursday, April 16, 2015 3:31 PM > To: linux-kernel@vger.kernel.org; linux-fsdevel@vger.kernel.org; > linux-f2fs-devel@lists.sourceforge.net > Cc: Jaegeuk Kim > Subject: [f2fs-dev] [PATCH 1/3] f2fs: flush symlink path to avoid broken symlink after POR > > This patch tries to avoid broken symlink case after POR in best effort. > This results in performance regression. > But, if f2fs has inline_data and the target path is under 3KB-sized long, > the page would be stored in its inode_block, so that there would be no > performance regression. > > Note that, if user wants to keep this file atomically, it needs to trigger > dir->fsync. > And, there is still a hole to produce broken symlink. > > Signed-off-by: Jaegeuk Kim > --- > fs/f2fs/namei.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c > index 8055e30..5d990d8 100644 > --- a/fs/f2fs/namei.c > +++ b/fs/f2fs/namei.c > @@ -324,6 +324,17 @@ static int f2fs_symlink(struct inode *dir, struct dentry *dentry, > d_instantiate(dentry, inode); > unlock_new_inode(inode); > > + /* > + * Let's flush symlink data in order to avoid broken symlink as much as > + * possible. Nevertheless, fsyncing is the best way, but there is no > + * way to get a file descriptor in order to flush that. > + * > + * Note that, it needs to do dir->fsync to make this recoverable. > + * If the symlink path is stored into inline_data, there is no > + * performance regression. > + */ > + filemap_write_and_wait_range(inode->i_mapping, 0, symlen); One minor thing. filemap_write_and_wait_range(inode->i_mapping, 0, symlen - 1); Because we don't need to write out data exceed isize here. Thanks, > + > if (IS_DIRSYNC(dir)) > f2fs_sync_fs(sbi->sb, 1); > return err; > -- > 2.1.1 > > > ------------------------------------------------------------------------------ > BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT > Develop your own process in accordance with the BPMN 2 standard > Learn Process modeling best practices with Bonita BPM through live exercises > http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ > source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF > _______________________________________________ > Linux-f2fs-devel mailing list > Linux-f2fs-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel -- 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/