public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: akpm@linux-foundation.org
Cc: sergey.senozhatsky@gmail.com, m.jabrzyk@samsung.com,
	minchan@kernel.org, ngupta@vflare.org,
	mm-commits@vger.kernel.org, linux-kernel@vger.kernel.org,
	sergey.senozhatsky.work@gmail.com
Subject: Re: + zram-check-comp-algorithm-availability-earlier-v2.patch added to -mm tree
Date: Thu, 28 May 2015 13:12:57 +0900	[thread overview]
Message-ID: <20150528041257.GA3772@swordfish> (raw)
In-Reply-To: <556627bd.Vgj1VFUyl+Q0DdUT%akpm@linux-foundation.org>

On (05/27/15 13:23), akpm@linux-foundation.org wrote:
> This patch should soon appear at
>     http://ozlabs.org/~akpm/mmots/broken-out/zram-check-comp-algorithm-availability-earlier-v2.patch
> and later at
>     http://ozlabs.org/~akpm/mmotm/broken-out/zram-check-comp-algorithm-availability-earlier-v2.patch
[..]

Sir,

just for note, v2 has an updated commit message (no dmesg output)

8<---

Improvement idea by Marcin Jabrzyk.

comp_algorithm_store() silently accepts any supplied algorithm
name, because zram performs algorithm availability check later,
during the device configuration phase in disksize_store() and
emits the following error:
  "zram: Cannot initialise %s compressing backend"

this error line is somewhat generic and, besides, can indicate
a failed attempt to allocate compression backend's working
buffers.

add algorithm availability check to comp_algorithm_store():

  echo lzz > /sys/block/zram0/comp_algorithm
  -bash: echo: write error: Invalid argument

8<---


thanks,

	-ss

> ------------------------------------------------------
> From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> Subject: zram-check-comp-algorithm-availability-earlier-v2
> 
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> Cc: Marcin Jabrzyk <m.jabrzyk@samsung.com>
> Cc: Minchan Kim <minchan@kernel.org>
> Cc: Nitin Gupta <ngupta@vflare.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  drivers/block/zram/zcomp.c    |   10 +++++-----
>  drivers/block/zram/zram_drv.c |    5 +----
>  2 files changed, 6 insertions(+), 9 deletions(-)
> 
> diff -puN drivers/block/zram/zcomp.c~zram-check-comp-algorithm-availability-earlier-v2 drivers/block/zram/zcomp.c
> --- a/drivers/block/zram/zcomp.c~zram-check-comp-algorithm-availability-earlier-v2
> +++ a/drivers/block/zram/zcomp.c
> @@ -286,6 +286,11 @@ ssize_t zcomp_available_show(const char
>  	return sz;
>  }
>  
> +bool zcomp_available_algorithm(const char *comp)
> +{
> +	return find_backend(comp) != NULL;
> +}
> +
>  bool zcomp_set_max_streams(struct zcomp *comp, int num_strm)
>  {
>  	return comp->set_max_streams(comp, num_strm);
> @@ -320,11 +325,6 @@ void zcomp_destroy(struct zcomp *comp)
>  	kfree(comp);
>  }
>  
> -bool zcomp_available_algorithm(const char *comp)
> -{
> -	return find_backend(comp) != NULL;
> -}
> -
>  /*
>   * search available compressors for requested algorithm.
>   * allocate new zcomp and initialize it. return compressing
> diff -puN drivers/block/zram/zram_drv.c~zram-check-comp-algorithm-availability-earlier-v2 drivers/block/zram/zram_drv.c
> --- a/drivers/block/zram/zram_drv.c~zram-check-comp-algorithm-availability-earlier-v2
> +++ a/drivers/block/zram/zram_drv.c
> @@ -378,11 +378,8 @@ static ssize_t comp_algorithm_store(stru
>  	if (sz > 0 && zram->compressor[sz - 1] == '\n')
>  		zram->compressor[sz - 1] = 0x00;
>  
> -	if (!zcomp_available_algorithm(zram->compressor)) {
> -		pr_err("Error: unavailable compression algorithm: %s\n",
> -				zram->compressor);
> +	if (!zcomp_available_algorithm(zram->compressor))
>  		len = -EINVAL;
> -	}
>  
>  	up_write(&zram->init_lock);
>  	return len;
> _
> 
> Patches currently in -mm which might be from sergey.senozhatsky@gmail.com are
> 
> zram-add-compact-sysfs-entry-to-documentation.patch
> zram-cosmetic-zram_attr_ro-code-formatting-tweak.patch
> zram-use-idr-instead-of-zram_devices-array.patch
> zram-reorganize-code-layout.patch
> zram-remove-max_num_devices-limitation.patch
> zram-report-every-added-and-removed-device.patch
> zram-trivial-correct-flag-operations-comment.patch
> zram-return-zram-device_id-from-zram_add.patch
> zram-close-race-by-open-overriding.patch
> zram-add-dynamic-device-add-remove-functionality.patch
> zram-cosmetic-zram_bvec_write-cleanup.patch
> zram-cut-trailing-newline-in-algorithm-name.patch
> zram-check-comp-algorithm-availability-earlier.patch
> zram-check-comp-algorithm-availability-earlier-v2.patch
> linux-next.patch
> 
> --
> To unsubscribe from this list: send the line "unsubscribe mm-commits" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

           reply	other threads:[~2015-05-28  4:12 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <556627bd.Vgj1VFUyl+Q0DdUT%akpm@linux-foundation.org>]

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=20150528041257.GA3772@swordfish \
    --to=sergey.senozhatsky.work@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.jabrzyk@samsung.com \
    --cc=minchan@kernel.org \
    --cc=mm-commits@vger.kernel.org \
    --cc=ngupta@vflare.org \
    --cc=sergey.senozhatsky@gmail.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