Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755467AbbLXKLK (ORCPT ); Thu, 24 Dec 2015 05:11:10 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:51482 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755416AbbLXKLI (ORCPT ); Thu, 24 Dec 2015 05:11:08 -0500 X-AuditID: cbfee61a-f79266d000003652-08-567bc4bb2071 From: Chao Yu To: Jaegeuk Kim Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH 4/5] f2fs: support data flush in ioctl Date: Thu, 24 Dec 2015 18:10:25 +0800 Message-id: <016701d13e33$676f0bc0$364d2340$@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: AdE+M0mmwCE1DIlYQIWcguKzcCPFDQ== Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrDLMWRmVeSWpSXmKPExsVy+t9jAd3dR6rDDG6/Fbd4sn4Ws8WlRe4W l3fNYXNg9ti0qpPNY/eCz0wenzfJBTBHcdmkpOZklqUW6dslcGW82vWPuWASZ8WnJ63MDYxb 2bsYOTkkBEwkpi04ygZhi0lcuLceyObiEBJYyiixa20TE4TzilFi4YltrCBVbAIqEss7/jOB 2CJA9qFFl8EmMQt4SDR2fAerERYwk1j28iVYnEVAVaJn3n1GEJtXwFJi0Yz3zBC2oMSPyfdY IHq1JNbvPM4EYctLbF7zlhniIgWJHWdfM0Ls0pNYs30rVI24xMYjt1gmMArMQjJqFpJRs5CM moWkZQEjyypGidSC5ILipPRcw7zUcr3ixNzi0rx0veT83E2M4DB+JrWD8eAu90OMAhyMSjy8 EreqwoRYE8uKK3MPMUpwMCuJ8H7aVx0mxJuSWFmVWpQfX1Sak1p8iFGag0VJnLf2UmSYkEB6 YklqdmpqQWoRTJaJg1OqgXHpjyWhLz74v95w/X7Pb/mnfLXRmTuSGN5W2Obb7vXYePTdtYm7 cs2e6D518S2MYZUQ3lzrbeC5dlX4//ZZeuWnbViXX41f+z/kae4FXbsg0eUtx9gNuE8rBjFE X/r5NYEvcPa0rNtli85tlZ0vNuX+lYe/ZtYauB2uk/Ve7S9WNeOml3P6jaVKLMUZiYZazEXF iQCp0y7qXwIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1373 Lines: 47 Sometimes user want to sync all data belong to superblock into storage for persistence, 'syncfs' syscall is one option, still f2fs supports similar one through ioctl, difference is that sb releted kworker is online for writebacking concurrently. Signed-off-by: Chao Yu --- fs/f2fs/file.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index a60d088..91997a5 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1621,6 +1621,7 @@ static int f2fs_ioc_write_checkpoint(struct file *filp, unsigned long arg) struct f2fs_sb_info *sbi = F2FS_I_SB(inode); struct cp_control cpc; int err; + int flush_data; if (!capable(CAP_SYS_ADMIN)) return -EPERM; @@ -1628,6 +1629,15 @@ static int f2fs_ioc_write_checkpoint(struct file *filp, unsigned long arg) if (f2fs_readonly(sbi->sb)) return -EROFS; + if (get_user(flush_data, (__u32 __user *)arg)) + return -EFAULT; + + if (flush_data) { + err = sync_dirty_inodes(sbi, FILE_INODE); + if (err) + return err; + } + cpc.reason = __get_cp_reason(sbi); mutex_lock(&sbi->gc_mutex); -- 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/