ltp.lists.linux.it archive mirror
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Cyril Hrubis <chrubis@suse.cz>
Cc: Richard Palethorpe <rpalethorpe@suse.com>,
	Joerg Vehlow <joerg.vehlow@aox-tech.de>,
	linux-fsdevel@vger.kernel.org, ltp@lists.linux.it,
	automated-testing@lists.yoctoproject.org
Subject: Re: [LTP] [PATCH 2/6] API: tst_device: Track minimal size per filesystem
Date: Mon, 29 Aug 2022 13:29:16 +0200	[thread overview]
Message-ID: <YwyjDLcGzhDiWXkD@pevik> (raw)
In-Reply-To: <YwybzIVhMaCqYR/S@yuki>

Hi Cyril,

thanks a lot for a review!

...
> > +++ b/include/tst_fs.h
...
> > +unsigned int tst_min_fs_size(long f_type)
> > +{
> > +	switch (f_type) {
> > +	case 0:

> TST_ALL_FILESYSTEMS ?

Thanks for catching this. Mistake which is a result of very late Friday night coding.

> > +		return MAX(DEV_SIZE_MB_BTRFS, DEV_SIZE_MB_DEFAULT);

> I do not think that we should harcode this here. I would be for a more
> dynamic approach, i.e. add a function into the tst_supported_fs_types.c
> that loops over supported filesystems and chooses max over the minimal
> values for all supported filesystems. That way if we run on embedded
> targets the device size will be 16MB as long as btrfs-progs is not
> installed. Also that way we can easily define minimal size for xfs 300MB
> and things will work for embedded as long as xfs-progs are not
> installed.
Correct. So the value for .all_filesystems should be maximum of supported
filesystems. The only think I don't like about it that it takes some time to
check everything (mkfs.* available ... etc), but we can't avoid it.

Is it worth to cache this value (make it static in the function) so that it's not
searched more than once?

> > +	case TST_BTRFS_MAGIC:
> > +		return DEV_SIZE_MB_BTRFS;
> > +	case TST_SQUASHFS_MAGIC:
> > +		return DEV_SIZE_MB_SQUASHFS;
> > +	default:
> > +		return DEV_SIZE_MB_DEFAULT;
> > +	}
> > +}
...
> > +++ b/lib/tst_fs_type.c
> > @@ -43,6 +43,34 @@ long tst_fs_type_(void (*cleanup)(void), const char *path)
> >  	return sbuf.f_type;
> >  }

> > +long tst_fs_name_type(const char *fs)
> > +{
> > +	if (!strcmp(fs, "btrfs"))
> > +		return TST_BTRFS_MAGIC;
> > +	else if (!strcmp(fs, "exfat"))
> > +		return TST_EXFAT_MAGIC;
> > +	else if (!strcmp(fs, "ext2"))
> > +		return TST_EXT2_OLD_MAGIC;

> I'm not sure that this is a correct mapping, I think that all ext
> filesystems goes by EXT234_MAGIC these days.
OK, I'll dig into kernel's fs/ext{2,4}/
The problem is, that we still theoretically support kernel 3.0,
thus old kernels are likely using this approach and newer not.
Let's see if and when it was changed.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2022-08-29 11:29 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-27  0:28 [LTP] [PATCH 0/6] Track minimal size per filesystem Petr Vorel
2022-08-27  0:28 ` [LTP] [PATCH 1/6] tst_fs_type: Add nsfs, vfat, squashfs to tst_fs_type_name() Petr Vorel
2022-08-29 10:44   ` Cyril Hrubis
2022-08-29 15:46   ` Bird, Tim
2022-08-29 16:14     ` Petr Vorel
2022-08-29 16:35       ` Bird, Tim
2022-08-29 16:49         ` Petr Vorel
2022-08-30  5:59   ` Li Wang
2022-08-27  0:28 ` [LTP] [PATCH 2/6] API: tst_device: Track minimal size per filesystem Petr Vorel
2022-08-29 10:58   ` Cyril Hrubis
2022-08-29 11:29     ` Petr Vorel [this message]
2022-08-29 12:24       ` [LTP] [Automated-testing] " Cyril Hrubis
2022-08-30  6:11     ` [LTP] " Li Wang
2022-08-27  0:28 ` [LTP] [PATCH 3/6] tst_test: Use 16 MB also for tmpfs Petr Vorel
2022-08-29 11:00   ` Cyril Hrubis
2022-08-30  6:12   ` Li Wang
2022-08-27  0:28 ` [LTP] [PATCH 4/6] tst_device: Use getopts Petr Vorel
2022-08-29 11:03   ` [LTP] [Automated-testing] " Cyril Hrubis
2022-08-29 11:42     ` Petr Vorel
2022-08-30  6:14   ` [LTP] " Li Wang
2022-08-27  0:28 ` [LTP] [PATCH 5/6] tst_device: Add support -f filesystem Petr Vorel
2022-08-29 11:04   ` Cyril Hrubis
2022-08-30  6:14   ` Li Wang
2022-08-27  0:28 ` [LTP] [PATCH 6/6] tst_test.sh: Pass used filesystem to tst_device Petr Vorel
2022-08-29 11:05   ` Cyril Hrubis
2022-08-30  6:16   ` Li Wang
2022-08-29 10:43 ` [LTP] [Automated-testing] [PATCH 0/6] Track minimal size per filesystem Cyril Hrubis
2022-08-29 11:39   ` Petr Vorel
2022-08-30  5:52     ` Li Wang
2022-08-30  8:18       ` Petr Vorel

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=YwyjDLcGzhDiWXkD@pevik \
    --to=pvorel@suse.cz \
    --cc=automated-testing@lists.yoctoproject.org \
    --cc=chrubis@suse.cz \
    --cc=joerg.vehlow@aox-tech.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=ltp@lists.linux.it \
    --cc=rpalethorpe@suse.com \
    /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).