From patchwork Sun Sep 29 06:17:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: LongPing Wei X-Patchwork-Id: 13814833 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C872ACF6498 for ; Sun, 29 Sep 2024 06:19:05 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1sunGq-0001CD-BN; Sun, 29 Sep 2024 06:19:04 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1sunGo-0001C6-Mx for linux-f2fs-devel@lists.sourceforge.net; Sun, 29 Sep 2024 06:19:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Type:Content-Transfer-Encoding :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=He3o0Qe716045DnV+apOojVowluGeb2fYgxvCmmbUDY=; b=LX8iY3BJiT7BIj2F05zyKKMei+ W1RLSp/D2Ml4kmiJSJAX6LN3cdKpTyMwa7hAU9Qf3VJe+Sy/vjj/HRF36bFzzoFdYXW7056rPmKcE 2aY/YJYcJNi3Zc4PAsZ/Zc8p49lkTBQL3jVlCuWJZQsucvLVJMrVh1CJNy9PtwzI+iiI=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=MIME-Version:Content-Type:Content-Transfer-Encoding:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=He3o0Qe716045DnV+apOojVowluGeb2fYgxvCmmbUDY=; b=N/Z30KG+j/27xZJOUt9xKt3xon MFnPvLMLIZSwDT0JuPFQzXkopMPqeG8I22Mf9fdv4/QV+YxX2GUcHx5oR/UbOWNTsAo1XgtBaHmHH 1Y1mIhkQH/UTlvrFWbsnnsnAWlfpF6MFZdBGfoQZ5zS4xoOcHPqcWGu4sg27HyTmMl0I=; Received: from mail-psaapc01on2070.outbound.protection.outlook.com ([40.107.255.70] helo=APC01-PSA-obe.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1sunGn-00006M-Py for linux-f2fs-devel@lists.sourceforge.net; Sun, 29 Sep 2024 06:19:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QvQybJ8vZPc4LdsfrW3+EB6fr1QmcxyieQX4ooXAKLsx1XKjsz6yxazxXzpvr7rUuLe0AZOzmUGJuFrUdf4wzrOMZeTaX5kcVlxgQDmrrCi+3CMX6K4iCqgoy6V3lrB5N0w8aYoRYTcF7OuGsuVJ0PjN1rWe8BpWU9VoWd2q5WV3xh/vdPe22VjYbtmVVEhm6JO5FPb95yB/Tpsk6mjzY81q7NQHZuNTo7iFaZg2KMy7rgVlvMOVmE2D5jpBJwnw+bcwD3BVQgRR0O73qNxULW9pPnSi4xcHdmkvTs7JA91CHqyLc4vYocg2yFFNifPOTLq794FwbccsDZ/6k1jhQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=He3o0Qe716045DnV+apOojVowluGeb2fYgxvCmmbUDY=; b=jF0TfdnoNnAsLHY+wgdoYAIF7ValhwHnRkK+OmDnIhDsM7sIHdTQs3+IW3zcCBmZwsui6CoK+TeKTGvaky+vev/ZiqPcw06AqPzzWhV9Z0nmgJKGgdkYfzFHjomkvHYJGw/AsfTaA4B1Y769uEUp/PWfniSsSRqU4Nv2MLWoQitGuX9qvoM2nniiuWNyRP7r1xCiGzBNEEhE5z1ih4bZeGADfXqGU3Eh77ffg92INwP8Dca8NUkC1kGkasgrm2q67HhUV5KpYsyW75pdlo9649HJWFGTp2BmTkK2U6WkNshnbJAmcQPCBymG3OYocKJqlyorhq1sBwUHMI+x2dQx7A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oppo.com; dmarc=pass action=none header.from=oppo.com; dkim=pass header.d=oppo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oppo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=He3o0Qe716045DnV+apOojVowluGeb2fYgxvCmmbUDY=; b=R2GIuzgqdR/TmSYJof1vXnLxFcWxD+7thbg67d8TlLYJ74Z3TTiLq22xCLeT4vc3uCkudcaVs2M2OFZTieUiV3CPy7vCU8pmaksOSGc9ud0FbwjYob7Kguy4g7hqCpnVrcjHEkQYjdcF+Hh+NsekfF6Ag2ByEKw2OaykepkZJ3g= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oppo.com; Received: from SEZPR02MB7967.apcprd02.prod.outlook.com (2603:1096:101:22a::14) by TYZPR02MB7318.apcprd02.prod.outlook.com (2603:1096:405:46::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.34; Sun, 29 Sep 2024 06:18:47 +0000 Received: from SEZPR02MB7967.apcprd02.prod.outlook.com ([fe80::5723:5b88:ed4c:d49b]) by SEZPR02MB7967.apcprd02.prod.outlook.com ([fe80::5723:5b88:ed4c:d49b%3]) with mapi id 15.20.7982.033; Sun, 29 Sep 2024 06:18:47 +0000 To: jaegeuk@kernel.org, chao@kernel.org Date: Sun, 29 Sep 2024 14:17:14 +0800 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: <85588954-f628-48ee-b860-9454b2c4fd1f@kernel.org> References: <85588954-f628-48ee-b860-9454b2c4fd1f@kernel.org> X-ClientProxiedBy: SG2PR02CA0061.apcprd02.prod.outlook.com (2603:1096:4:54::25) To SEZPR02MB7967.apcprd02.prod.outlook.com (2603:1096:101:22a::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR02MB7967:EE_|TYZPR02MB7318:EE_ X-MS-Office365-Filtering-Correlation-Id: 43075016-c080-41ca-63fe-08dce04e937b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|52116014|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: nSkdojEqYldmk1PYLl5N3sFBmeurZPuwP5uow/o/v5e2JeCp8eq4+xFi6Pz0DicYpo6r2Fkj9dbCckN2oono/DgwCeNWksv7MDx0Qe50VtHUdAKw0EYCHbeTSfaukqhDFhUXXGViQ3C8LeMSwcKPY8QDg8Oaoa4PkwvA29HmmU77bsfByEm1ej48LYGAez+uhLTt/7Mv30DOG8xheoF77WsVil8JqFrjD9k/+Gv7ZOuq3a5vUFphgZGsSGTzUPJMAFvv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R/DQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SEZPR02MB7967.apcprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(52116014)(376014)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TYfdUKkKSIVFlBLr1gUOij/mR59qSEHoU7s9V6DYfv09hkqrfTh+fiLYRfMSCiweI1dfxx8BxhwQAln4UK/uYSRGcupx8xxT1fD7ExcmTkWa/eHIrz+bpFSE7aSrepbehtMeBzXl2OmJUMZC3RZ+Mo971XWXy4wOnwuZEprvGXTjbKUI5cRkCOBNvrWRHz8ILxuRPCydzwlPQVEIHW51dLh7Rl7VHyBf86CZYv+NFGOJaf2fO77ZM4GPFOXDbxi2aU7wqzNwsHBvXRYEEKCMmF2xgirRc7WyDGjbV6CoW9eqsbaNsmwtDIInS/vsAaZzw1eDe0Z+YYmpnnWZZINoCXh/BWIF7KP5Dv6RbLG7SlHGLErvVzoql1RYzWlGkVaTz7e/JEN2IEK73ugHSAtat0aU1axZqzAJi26sauCA9Q4X1+UEvs73i8lYR9fFKqi9yUS18zztPj4QZBFHlJgLmVL+oB4mgpXU1osryCbKl6ewaQbGXiYdUG0Zv6eEVZkCMNIwF0sVe6I+BYfP9h+Ph6gn51G4MHBAhxV4Ask7XL39n9mwXdYvtHaue04A4dAHa5kHSlfBTYNFwHuJr3pyCgWI7ezqI3MQSfpAMl3OM+qTtnlDlAVDvYMvi+5bjcGBueQYt6gayOjHXXK7hm3lJvTr2xSAmVjO+7FhCeGclZVq5Jjb/CvnXmA06rFp4FDmG2uAMmidPIKIGXl9dxNtrtCT6vg7ckmeJ9hPSNkVU3jzkYJlKAccZ5u3khb+NF/lE6P+vdjSFp5rb3rlDR0ZlWlBXu2suMUWwwVYS47O50AU4fcoYg/QjQxGCFyQSWGJpfBEAHppbJazKIpNCTPAze4AM3xAwqh1mnvApR4Ckrsd/70Ss27hGkzlp+whQyBJCYDdHmgE+3b7nmRMH9u+fVNNF/CCQ/NzaaDBmQPblYF8JOPuTULNBVQ5qjckfZhOH6UShrebCYMJrV59gok9udv8jcOYBg+at9H4SkItPG5q8I/SjsyBalEqDGpasfwMoFjnnj/SVcR2AZ+MZiaVLYvthHcW3RTqjyQ3r0OL2GF+0kz1qItO5hrldOe1oD5HG9JBe9rtnle5+f/zhOVPsLEg+pZsqhDuRocf82V2CLe+i1Hlu5HL3sw23YV0eufN8cSNB59y0FsOddYNHlRXOre7YxW6x4Fu7YZ6aVT/QmFrHKrDtK4DeojIvgL0KBkdETrQn5cXcM36fSMtc4N6ewXxeQ6stmDemtuR7Nvc2XeocoJ/Z96AarWAzQW8sbWelV6Xt8XSIlfGZh31Nm4SIZO1mnpK1dD/bATfaJWw68p26YboZuZTRjvvGi4Gh5caey3qMvJsh5vEZld7XI0XrAw+Y+ExN3bhSYWyEo9szy/s2dy48FbKBW0eh1k+5ZdGYJvIRbhNcFJkjEDi36R/t6NEtAC1M3I4FYvaK8tHa0YIzmzGq+K77bKo5yKuWI9GnubEeC2oZUYgBA+6po5HlRnyt44Vw6vha29MbgvHxU95nS7iVJ6ouKsnokhs9FPPoke5wpLfvB70KvxFepolijvZVfNC7KF3A2lT4kUMKirHQXM0MyaVtNyvEx5GompL X-OriginatorOrg: oppo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 43075016-c080-41ca-63fe-08dce04e937b X-MS-Exchange-CrossTenant-AuthSource: SEZPR02MB7967.apcprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2024 06:18:46.8160 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f1905eb1-c353-41c5-9516-62b4a54b5ee6 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: MoYCaUUjWJXmnL8ejEeK6jjrAkRoUo9glA8cPW8GrMmCNCxrjb7UvM5SkCHVlUvgCGGs7RKOXQ2PMzQAw3/+lg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR02MB7318 X-Headers-End: 1sunGn-00006M-Py Subject: [f2fs-dev] [PATCH v2] f2fs_io: add fdatasync X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: LongPing Wei via Linux-f2fs-devel From: LongPing Wei Reply-To: LongPing Wei Cc: LongPing Wei , linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Signed-off-by: LongPing Wei Reviewed-by: Chao Yu --- v2: update manual of f2fs_io --- man/f2fs_io.8 | 6 ++++++ tools/f2fs_io/f2fs_io.c | 25 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/man/f2fs_io.8 b/man/f2fs_io.8 index b9c9dc8..124d662 100644 --- a/man/f2fs_io.8 +++ b/man/f2fs_io.8 @@ -11,6 +11,12 @@ administrative purposes. \fBset_verity\fR \fI[file]\fR Set the verity flags associated with the specified file. .TP +\fBfsync\fR \fI[file]\fR +fsync given the file. +.TP +\fBfdatasync\fR \fI[file]\fR +fdatasync given the file. +.TP \fBgetflags\fR \fI[file]\fR Get the flags associated with the specified file. .TP diff --git a/tools/f2fs_io/f2fs_io.c b/tools/f2fs_io/f2fs_io.c index 94f0adf..8fbad3c 100644 --- a/tools/f2fs_io/f2fs_io.c +++ b/tools/f2fs_io/f2fs_io.c @@ -174,6 +174,30 @@ static void do_fsync(int argc, char **argv, const struct cmd_desc *cmd) exit(0); } +#define fdatasync_desc "fdatasync" +#define fdatasync_help \ +"f2fs_io fdatasync [file]\n\n" \ +"fdatasync given the file\n" \ + +static void do_fdatasync(int argc, char **argv, const struct cmd_desc *cmd) +{ + int fd; + + if (argc != 2) { + fputs("Excess arguments\n\n", stderr); + fputs(cmd->cmd_help, stderr); + exit(1); + } + + fd = xopen(argv[1], O_WRONLY, 0); + + if (fdatasync(fd) != 0) + die_errno("fdatasync failed"); + + printf("fdatasync a file\n"); + exit(0); +} + #define set_verity_desc "Set fs-verity" #define set_verity_help \ "f2fs_io set_verity [file]\n\n" \ @@ -1808,6 +1832,7 @@ static void do_help(int argc, char **argv, const struct cmd_desc *cmd); const struct cmd_desc cmd_list[] = { _CMD(help), CMD(fsync), + CMD(fdatasync), CMD(set_verity), CMD(getflags), CMD(setflags),