fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: fstests@vger.kernel.org, kernel-team@fb.com, linux-btrfs@vger.kernel.org
Subject: [PATCH 3/3] fsstress: allow operations to use either a directory or subvol
Date: Thu, 14 Nov 2019 10:58:36 -0500	[thread overview]
Message-ID: <20191114155836.3528-4-josef@toxicpanda.com> (raw)
In-Reply-To: <20191114155836.3528-1-josef@toxicpanda.com>

Most operations are just looking for a base directory to generate a file
in, they don't actually need a directory specifically.  Add FT_ANYDIR to
cover both directories and subvolumes, and then use this in all the
places where it makes sense.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 ltp/fsstress.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index f7f5f1dc..30b2bd94 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -200,6 +200,7 @@ struct print_string {
 #define	FT_ANYm		((1 << FT_nft) - 1)
 #define	FT_REGFILE	(FT_REGm | FT_RTFm)
 #define	FT_NOTDIR	(FT_ANYm & (~FT_DIRm & ~FT_SUBVOLm))
+#define FT_ANYDIR	(FT_DIRm | FT_SUBVOLm)
 
 #define	FLIST_SLOT_INCR	16
 #define	NDCACHE	64
@@ -3165,7 +3166,7 @@ creat_f(int opno, long r)
 	int		v;
 	int		v1;
 
-	if (!get_fname(FT_DIRm, r, NULL, NULL, &fep, &v1))
+	if (!get_fname(FT_ANYDIR, r, NULL, NULL, &fep, &v1))
 		parid = -1;
 	else
 		parid = fep->id;
@@ -3729,7 +3730,7 @@ getdents_f(int opno, long r)
 	int		v;
 
 	init_pathname(&f);
-	if (!get_fname(FT_DIRm, r, &f, NULL, NULL, &v))
+	if (!get_fname(FT_ANYDIR, r, &f, NULL, NULL, &v))
 		append_pathname(&f, ".");
 	dir = opendir_path(&f);
 	check_cwd();
@@ -3761,7 +3762,7 @@ getfattr_f(int opno, long r)
 	int             xattr_num;
 
 	init_pathname(&f);
-	if (!get_fname(FT_REGFILE | FT_DIRm, r, &f, NULL, &fep, &v)) {
+	if (!get_fname(FT_REGFILE | FT_ANYDIR, r, &f, NULL, &fep, &v)) {
 		if (v)
 			printf("%d/%d: getfattr - no filename\n", procid, opno);
 		goto out;
@@ -3880,7 +3881,7 @@ listfattr_f(int opno, long r)
 	int             buffer_len;
 
 	init_pathname(&f);
-	if (!get_fname(FT_REGFILE | FT_DIRm, r, &f, NULL, &fep, &v)) {
+	if (!get_fname(FT_REGFILE | FT_ANYDIR, r, &f, NULL, &fep, &v)) {
 		if (v)
 			printf("%d/%d: listfattr - no filename\n", procid, opno);
 		goto out;
@@ -3930,7 +3931,7 @@ mkdir_f(int opno, long r)
 	int		v;
 	int		v1;
 
-	if (!get_fname(FT_DIRm, r, NULL, NULL, &fep, &v))
+	if (!get_fname(FT_ANYDIR, r, NULL, NULL, &fep, &v))
 		parid = -1;
 	else
 		parid = fep->id;
@@ -3968,7 +3969,7 @@ mknod_f(int opno, long r)
 	int		v;
 	int		v1;
 
-	if (!get_fname(FT_DIRm, r, NULL, NULL, &fep, &v))
+	if (!get_fname(FT_ANYDIR, r, NULL, NULL, &fep, &v))
 		parid = -1;
 	else
 		parid = fep->id;
@@ -4326,7 +4327,7 @@ removefattr_f(int opno, long r)
 	int             xattr_num;
 
 	init_pathname(&f);
-	if (!get_fname(FT_REGFILE | FT_DIRm, r, &f, NULL, &fep, &v)) {
+	if (!get_fname(FT_REGFILE | FT_ANYDIR, r, &f, NULL, &fep, &v)) {
 		if (v)
 			printf("%d/%d: removefattr - no filename\n", procid, opno);
 		goto out;
@@ -4646,7 +4647,7 @@ setfattr_f(int opno, long r)
 	int             xattr_num;
 
 	init_pathname(&f);
-	if (!get_fname(FT_REGFILE | FT_DIRm, r, &f, NULL, &fep, &v)) {
+	if (!get_fname(FT_REGFILE | FT_ANYDIR, r, &f, NULL, &fep, &v)) {
 		if (v)
 			printf("%d/%d: setfattr - no filename\n", procid, opno);
 		goto out;
@@ -4792,7 +4793,7 @@ subvol_create_f(int opno, long r)
 	int			err;
 
 	init_pathname(&f);
-	if (!get_fname(FT_DIRm | FT_SUBVOLm, r, NULL, NULL, &fep, &v))
+	if (!get_fname(FT_ANYDIR, r, NULL, NULL, &fep, &v))
 		parid = -1;
 	else
 		parid = fep->id;
@@ -4872,7 +4873,7 @@ symlink_f(int opno, long r)
 	int		v1;
 	char		*val;
 
-	if (!get_fname(FT_DIRm, r, NULL, NULL, &fep, &v))
+	if (!get_fname(FT_ANYDIR, r, NULL, NULL, &fep, &v))
 		parid = -1;
 	else
 		parid = fep->id;
-- 
2.21.0


  parent reply	other threads:[~2019-11-14 15:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-14 15:58 [PATCH 0/3] fsstress: add support for btrfs subvol and snapshot ops Josef Bacik
2019-11-14 15:58 ` [PATCH 1/3] fsstress: add the ability to create/delete subvolumes Josef Bacik
2019-11-14 18:14   ` [PATCH][v2] " Josef Bacik
2019-12-17 15:55     ` Filipe Manana
2019-11-14 15:58 ` [PATCH 2/3] fsstress: add the ability to create snapshots Josef Bacik
2019-12-17 16:06   ` Filipe Manana
2019-11-14 15:58 ` Josef Bacik [this message]
2019-12-17 16:10   ` [PATCH 3/3] fsstress: allow operations to use either a directory or subvol Filipe Manana

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191114155836.3528-4-josef@toxicpanda.com \
    --to=josef@toxicpanda.com \
    --cc=fstests@vger.kernel.org \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).