All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Geliang Tang <geliangtang@163.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Minchan Kim <minchan@kernel.org>,
	Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] zram: make is_partial_io/valid_io_request/page_zero_filled return boolean
Date: Tue, 20 Oct 2015 19:15:54 +0900	[thread overview]
Message-ID: <20151020101554.GA429@swordfish> (raw)
In-Reply-To: <c825078384dd5424248c4d21dfc6878ba25299a5.1445363514.git.geliangtang@163.com>

Cc Andrew

On (10/20/15 02:55), Geliang Tang wrote:
> This patch makes is_partial_io()/valid_io_request()/page_zero_filled()
> return boolean, since each function only uses either one or zero as its
> return value.
> 
> Signed-off-by: Geliang Tang <geliangtang@163.com>

looks good to me, but I'm not a huge fan of patches like this.

Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>

	-ss

> ---
>  drivers/block/zram/zram_drv.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
> index 3e8d8ff..81a557c 100644
> --- a/drivers/block/zram/zram_drv.c
> +++ b/drivers/block/zram/zram_drv.c
> @@ -106,7 +106,7 @@ static void zram_set_obj_size(struct zram_meta *meta,
>  	meta->table[index].value = (flags << ZRAM_FLAG_SHIFT) | size;
>  }
>  
> -static inline int is_partial_io(struct bio_vec *bvec)
> +static inline bool is_partial_io(struct bio_vec *bvec)
>  {
>  	return bvec->bv_len != PAGE_SIZE;
>  }
> @@ -114,25 +114,25 @@ static inline int is_partial_io(struct bio_vec *bvec)
>  /*
>   * Check if request is within bounds and aligned on zram logical blocks.
>   */
> -static inline int valid_io_request(struct zram *zram,
> +static inline bool valid_io_request(struct zram *zram,
>  		sector_t start, unsigned int size)
>  {
>  	u64 end, bound;
>  
>  	/* unaligned request */
>  	if (unlikely(start & (ZRAM_SECTOR_PER_LOGICAL_BLOCK - 1)))
> -		return 0;
> +		return false;
>  	if (unlikely(size & (ZRAM_LOGICAL_BLOCK_SIZE - 1)))
> -		return 0;
> +		return false;
>  
>  	end = start + (size >> SECTOR_SHIFT);
>  	bound = zram->disksize >> SECTOR_SHIFT;
>  	/* out of range range */
>  	if (unlikely(start >= bound || end > bound || start > end))
> -		return 0;
> +		return false;
>  
>  	/* I/O request is valid */
> -	return 1;
> +	return true;
>  }
>  
>  static void update_position(u32 *index, int *offset, struct bio_vec *bvec)
> @@ -157,7 +157,7 @@ static inline void update_used_max(struct zram *zram,
>  	} while (old_max != cur_max);
>  }
>  
> -static int page_zero_filled(void *ptr)
> +static bool page_zero_filled(void *ptr)
>  {
>  	unsigned int pos;
>  	unsigned long *page;
> @@ -166,10 +166,10 @@ static int page_zero_filled(void *ptr)
>  
>  	for (pos = 0; pos != PAGE_SIZE / sizeof(*page); pos++) {
>  		if (page[pos])
> -			return 0;
> +			return false;
>  	}
>  
> -	return 1;
> +	return true;
>  }
>  
>  static void handle_zero_page(struct bio_vec *bvec)
> -- 
> 1.9.1
> 
> 

      reply	other threads:[~2015-10-20 10:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-20  9:55 [PATCH] zram: make is_partial_io/valid_io_request/page_zero_filled return boolean Geliang Tang
2015-10-20 10:15 ` Sergey Senozhatsky [this message]

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=20151020101554.GA429@swordfish \
    --to=sergey.senozhatsky.work@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=geliangtang@163.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minchan@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.