mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Phillip Lougher <phillip@squashfs.org.uk>
To: Xiaoming Ni <nixiaoming@huawei.com>, linux-kernel@vger.kernel.org
Cc: wangle6@huawei.com, yi.zhang@huawei.com, wangbing6@huawei.com,
	zhongjubin@huawei.com, chenjianguo3@huawei.com
Subject: Re: ping //Re: [PATCH v2 0/2] squashfs: Add the mount parameter "threads="
Date: Tue, 30 Aug 2022 19:34:44 +0100	[thread overview]
Message-ID: <ab006c5e-1729-3e46-0daa-0df43a05a88b@squashfs.org.uk> (raw)
In-Reply-To: <74fb0469-e593-ed0e-3f9b-5ec535969c78@squashfs.org.uk>

On 30/08/2022 19:08, Phillip Lougher wrote:
> On 30/08/2022 14:38, Xiaoming Ni wrote:
>> On 2022/8/29 7:18, Phillip Lougher wrote:

>>> As regards points 1 - 3, personally I would add a default kernel
>>> configuration option that keeps the existing behaviour, build time
>>> selectable only, no additional mount time options.  Then a
>>> kernel configuration option that allows the different decompressors
>>> to be selected at mount time, but which always builds all the
>>> decompressors.  This will avoid the silliness of point 2, and
>> Would it be better to allow flexible selection of decompression mode 
>> combinations?
> 
> I told you I don't like that (*).  I also told you I want the default 
> behaviour to be the current behaviour.
> 
> Feel free to disagree, but that isn't a good way to get your patch
> reviewed or accepted by me.
> 
> Cheers
> 
> Phillip
> 
> (*) Adding options to select the decompressor at mount time, but,
>      also allowing only 1 - 2 decompressors to be built is a waste of
>      time.  It has the effect of giving something with one hand and
>      taking it alway with the other.  Build the lot, this also
>      keeps it simple.
> 
> 

It also splatters super.c with #ifdef CONFIG lines.

phillip@phoenix:/external/stripe/linux/fs/squashfs$ grep "CONFIG_" super.c
#ifdef CONFIG_SQUASHFS_DECOMP_SINGLE
#ifdef CONFIG_SQUASHFS_DECOMP_MULTI
#ifdef CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU
#ifdef CONFIG_SQUASHFS_DECOMP_SINGLE
#ifdef CONFIG_SQUASHFS_DECOMP_MULTI
#ifdef CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU
#ifdef CONFIG_SQUASHFS_DECOMP_DEFAULT_SINGLE
#elif defined(CONFIG_SQUASHFS_DECOMP_DEFAULT_MULTI)
#elif defined(CONFIG_SQUASHFS_DECOMP_DEFAULT_PERCPU)

Or

static int squashfs_parse_param_threads(const char *str, struct 
squashfs_mount_opts *opts)
{
         unsigned long num;
         int ret;
#ifdef CONFIG_SQUASHFS_DECOMP_SINGLE
         if (strcmp(str, "single") == 0) {
                 opts->thread_ops = &squashfs_decompressor_single;
                 return 0;
         }
#endif
#ifdef CONFIG_SQUASHFS_DECOMP_MULTI
         if (strcmp(str, "multi") == 0) {
                 opts->thread_ops = &squashfs_decompressor_multi;
                 return 0;
         }
#endif
#ifdef CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU
         if (strcmp(str, "percpu") == 0) {
                 opts->thread_ops = &squashfs_decompressor_percpu;
                 return 0;
         }
#endif
         ret = kstrtoul(str, 0, &num);
         if (ret != 0 || num == 0)
                 return -EINVAL;
#ifdef CONFIG_SQUASHFS_DECOMP_SINGLE
         if (num == 1) {
                 opts->thread_ops = &squashfs_decompressor_single;
                 return 0;
         }
#endif
#ifdef CONFIG_SQUASHFS_DECOMP_MULTI
         opts->thread_ops = &squashfs_decompressor_multi;
         if (num > opts->thread_ops->max_decompressors())
                 num = opts->thread_ops->max_decompressors();
         opts->thread_num = (int)num;
         return 0;
#else
         return -EINVAL;
#endif
}

SNIP

static int squashfs_show_options(struct seq_file *s, struct dentry *root)
{
         struct super_block *sb = root->d_sb;
         struct squashfs_sb_info *msblk = sb->s_fs_info;

         if (msblk->panic_on_errors)
                 seq_puts(s, ",errors=panic");
         else
                 seq_puts(s, ",errors=continue");

#ifdef CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU
         /*
          * thread=percpu and thread=<number> have different 
configuration effects.
          * the parameters need to be treated differently when they are 
displayed.
          */
         if (msblk->thread_ops == &squashfs_decompressor_percpu) {
                 seq_puts(s, ",threads=percpu");
                 return 0;
         }
#endif
         seq_printf(s, ",threads=%u", msblk->max_thread_num);
         return 0;
}

static int squashfs_init_fs_context(struct fs_context *fc)
{
         struct squashfs_mount_opts *opts;

         opts = kzalloc(sizeof(*opts), GFP_KERNEL);
         if (!opts)
                 return -ENOMEM;

#ifdef CONFIG_SQUASHFS_DECOMP_DEFAULT_SINGLE
         opts->thread_ops = &squashfs_decompressor_single;
#elif defined(CONFIG_SQUASHFS_DECOMP_DEFAULT_MULTI)
         opts->thread_ops = &squashfs_decompressor_multi,
#elif defined(CONFIG_SQUASHFS_DECOMP_DEFAULT_PERCPU)
         opts->thread_ops = &squashfs_decompressor_percpu;
#endif


  reply	other threads:[~2022-08-30 18:35 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-15  3:10 [PATCH " Xiaoming Ni
2022-08-15  3:10 ` [PATCH 1/2] squashfs: add the mount parameter theads=<single|multi|percpu> Xiaoming Ni
2022-08-15 11:19   ` kernel test robot
2022-08-15  3:11 ` [PATCH 2/2] squashfs: Allows users to configure the number of decompression threads Xiaoming Ni
2022-08-16  1:00 ` [PATCH v2 0/2] squashfs: Add the mount parameter "threads=" Xiaoming Ni
2022-08-16  1:00   ` [PATCH v2 1/2] squashfs: add the mount parameter theads=<single|multi|percpu> Xiaoming Ni
2022-08-16  1:00   ` [PATCH v2 2/2] squashfs: Allows users to configure the number of decompression threads Xiaoming Ni
2022-08-26  6:19   ` ping //Re: [PATCH v2 0/2] squashfs: Add the mount parameter "threads=" Xiaoming Ni
2022-08-28 23:18     ` Phillip Lougher
2022-08-30 13:38       ` Xiaoming Ni
2022-08-30 18:08         ` Phillip Lougher
2022-08-30 18:34           ` Phillip Lougher [this message]
2022-08-31  1:09             ` Xiaoming Ni
2022-09-02  9:48   ` [PATCH v3 " Xiaoming Ni
2022-09-02  9:48     ` [PATCH v3 1/2] squashfs: add the mount parameter theads=<single|multi|percpu> Xiaoming Ni
2022-09-09 15:44       ` Phillip Lougher
2022-09-13  2:46         ` Xiaoming Ni
2022-09-09 15:50       ` Phillip Lougher
2022-09-13  2:47         ` Xiaoming Ni
2022-09-02  9:48     ` [PATCH v3 2/2] squashfs: Allows users to configure the number of decompression threads Xiaoming Ni
2022-09-09 15:26     ` [PATCH v3 0/2] squashfs: Add the mount parameter "threads=" Phillip Lougher
2022-09-16  8:36     ` [PATCH v4 " Xiaoming Ni
2022-09-16  8:36       ` [PATCH v4 1/2] squashfs: add the mount parameter theads=<single|multi|percpu> Xiaoming Ni
2022-09-28  2:20         ` Phillip Lougher
2022-09-28  3:06           ` Xiaoming Ni
2022-09-16  8:36       ` [PATCH v4 2/2] squashfs: Allows users to configure the number of decompression threads Xiaoming Ni
2022-09-27  1:05       ` ping //Re: [PATCH v4 0/2] squashfs: Add the mount parameter "threads=" Xiaoming Ni
2022-09-30  9:14       ` [PATCH v5 " Xiaoming Ni
2022-09-30  9:14         ` [PATCH v5 1/2] squashfs: add the mount parameter theads=<single|multi|percpu> Xiaoming Ni
2022-10-17 21:58           ` Re " Phillip Lougher
2022-09-30  9:14         ` [PATCH v5 2/2] squashfs: Allows users to configure the number of decompression threads Xiaoming Ni
2022-10-17  0:57         ` ping// Re: [PATCH v5 0/2] squashfs: Add the mount parameter "threads=" Xiaoming Ni
2022-10-17 22:59           ` Phillip Lougher
2022-10-18  6:24             ` Xiaoming Ni
2022-10-19  3:09         ` [PATCH v6 " Xiaoming Ni
2022-10-19  3:09           ` [PATCH v6 1/2] squashfs: add the mount parameter theads=<single|multi|percpu> Xiaoming Ni
2022-10-19  3:09           ` [PATCH v6 2/2] squashfs: Allows users to configure the number of decompression threads Xiaoming Ni
2022-10-27 22:44           ` [PATCH v6 0/2] squashfs: Add the mount parameter "threads=" Phillip Lougher

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=ab006c5e-1729-3e46-0daa-0df43a05a88b@squashfs.org.uk \
    --to=phillip@squashfs.org.uk \
    --cc=chenjianguo3@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nixiaoming@huawei.com \
    --cc=wangbing6@huawei.com \
    --cc=wangle6@huawei.com \
    --cc=yi.zhang@huawei.com \
    --cc=zhongjubin@huawei.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

all inboxes | Powered by JetHome®