lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250318072615.3505873-5-yi.zhang@huaweicloud.com>
Date: Tue, 18 Mar 2025 15:26:14 +0800
From: Zhang Yi <yi.zhang@...weicloud.com>
To: linux-fsdevel@...r.kernel.org,
	linux-ext4@...r.kernel.org,
	linux-block@...r.kernel.org,
	dm-devel@...ts.linux.dev,
	linux-nvme@...ts.infradead.org,
	linux-scsi@...r.kernel.org
Cc: linux-xfs@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	hch@....de,
	tytso@....edu,
	djwong@...nel.org,
	john.g.garry@...cle.com,
	bmarzins@...hat.com,
	chaitanyak@...dia.com,
	shinichiro.kawasaki@....com,
	yi.zhang@...wei.com,
	yi.zhang@...weicloud.com,
	chengzhihao1@...wei.com,
	yukuai3@...wei.com,
	yangerkun@...wei.com
Subject: [PATCH xfstests 4/5] fstress: add fallocate write zeroes support

From: Zhang Yi <yi.zhang@...wei.com>

Add fstress to suppoet fallocate FALLOC_FL_WRITE_ZEROES command by
introducing OP_WZERO operation.

Signed-off-by: Zhang Yi <yi.zhang@...wei.com>
---
 ltp/fsstress.c | 12 ++++++++++++
 src/global.h   |  4 ++++
 2 files changed, 16 insertions(+)

diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index 3d248ee2..ed2a54ab 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -114,6 +114,7 @@ typedef enum {
 	OP_MWRITE,
 	OP_PUNCH,
 	OP_ZERO,
+	OP_WZERO,
 	OP_COLLAPSE,
 	OP_INSERT,
 	OP_READ,
@@ -245,6 +246,7 @@ void	mread_f(opnum_t, long);
 void	mwrite_f(opnum_t, long);
 void	punch_f(opnum_t, long);
 void	zero_f(opnum_t, long);
+void	wzero_f(opnum_t, long);
 void	collapse_f(opnum_t, long);
 void	insert_f(opnum_t, long);
 void	unshare_f(opnum_t, long);
@@ -312,6 +314,7 @@ struct opdesc	ops[OP_LAST]	= {
 	[OP_MWRITE]	   = {"mwrite",	       mwrite_f,	2, 1 },
 	[OP_PUNCH]	   = {"punch",	       punch_f,		1, 1 },
 	[OP_ZERO]	   = {"zero",	       zero_f,		1, 1 },
+	[OP_WZERO]	   = {"wzero",	       wzero_f,		1, 1 },
 	[OP_COLLAPSE]	   = {"collapse",      collapse_f,	1, 1 },
 	[OP_INSERT]	   = {"insert",	       insert_f,	1, 1 },
 	[OP_READ]	   = {"read",	       read_f,		1, 0 },
@@ -3758,6 +3761,7 @@ struct print_flags falloc_flags [] = {
 	{ FALLOC_FL_NO_HIDE_STALE, "NO_HIDE_STALE"},
 	{ FALLOC_FL_COLLAPSE_RANGE, "COLLAPSE_RANGE"},
 	{ FALLOC_FL_ZERO_RANGE, "ZERO_RANGE"},
+	{ FALLOC_FL_WRITE_ZEROES, "WRITE_ZEROES"},
 	{ FALLOC_FL_INSERT_RANGE, "INSERT_RANGE"},
 	{ FALLOC_FL_UNSHARE_RANGE, "UNSHARE_RANGE"},
 	{ -1, NULL}
@@ -4446,6 +4450,14 @@ zero_f(opnum_t opno, long r)
 #endif
 }
 
+void
+wzero_f(opnum_t opno, long r)
+{
+#ifdef HAVE_LINUX_FALLOC_H
+	do_fallocate(opno, r, FALLOC_FL_WRITE_ZEROES);
+#endif
+}
+
 void
 collapse_f(opnum_t opno, long r)
 {
diff --git a/src/global.h b/src/global.h
index fbc0a0b5..6b1e30c9 100644
--- a/src/global.h
+++ b/src/global.h
@@ -175,6 +175,10 @@
 #define FALLOC_FL_ZERO_RANGE		0x10
 #endif
 
+#ifndef FALLOC_FL_WRITE_ZEROES
+#define FALLOC_FL_WRITE_ZEROES		0x80
+#endif
+
 #ifndef FALLOC_FL_INSERT_RANGE
 #define FALLOC_FL_INSERT_RANGE		0x20
 #endif
-- 
2.46.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ