On Thu, Nov 14, 2019 at 3:59 PM Josef Bacik <josef@xxxxxxxxxxxxxx> wrote: > > 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@xxxxxxxxxxxxxx> Looks good and it works for me, thanks. Reviewed-by: Filipe Manana <fdmanana@xxxxxxxx> > --- > 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 > -- Filipe David Manana, “Whether you think you can, or you think you can't — you're right.”