From: Jerome Marchand <jmarchan@redhat.com>
To: karam.lee@lge.com, minchan@kernel.org, ngupta@vflare.org,
linux-kernel@vger.kernel.org
Cc: matthew.r.wilcox@intel.com, seungho1.park@lge.com
Subject: Re: [PATCH v3 2/3] zram: change parameter from vaild_io_request()
Date: Tue, 21 Oct 2014 16:09:17 +0200 [thread overview]
Message-ID: <5446690D.3000909@redhat.com> (raw)
In-Reply-To: <1413876458-19279-3-git-send-email-karam.lee@lge.com>
[-- Attachment #1: Type: text/plain, Size: 2167 bytes --]
On 10/21/2014 09:27 AM, karam.lee@lge.com wrote:
> From: "karam.lee" <karam.lee@lge.com>
>
> This patch changes parameter of valid_io_request for common usage.
> The purpose of valid_io_request() is to determine if bio request is
> valid or not.
> This patch use I/O start address and size instead of a BIO parameter
> for common usage.
>
> Signed-off-by: karam.lee <karam.lee@lge.com>
Acked-by: Jerome Marchand <jmarchan@redhat.com>
> ---
> drivers/block/zram/zram_drv.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
> index 54da18a..4565fdc 100644
> --- a/drivers/block/zram/zram_drv.c
> +++ b/drivers/block/zram/zram_drv.c
> @@ -206,19 +206,18 @@ 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, struct bio *bio)
> +static inline int valid_io_request(struct zram *zram,
> + sector_t start, unsigned int size)
> {
> - u64 start, end, bound;
> + u64 end, bound;
>
> /* unaligned request */
> - if (unlikely(bio->bi_iter.bi_sector &
> - (ZRAM_SECTOR_PER_LOGICAL_BLOCK - 1)))
> + if (unlikely(start & (ZRAM_SECTOR_PER_LOGICAL_BLOCK - 1)))
> return 0;
> - if (unlikely(bio->bi_iter.bi_size & (ZRAM_LOGICAL_BLOCK_SIZE - 1)))
> + if (unlikely(size & (ZRAM_LOGICAL_BLOCK_SIZE - 1)))
> return 0;
>
> - start = bio->bi_iter.bi_sector;
> - end = start + (bio->bi_iter.bi_size >> SECTOR_SHIFT);
> + end = start + (size >> SECTOR_SHIFT);
> bound = zram->disksize >> SECTOR_SHIFT;
> /* out of range range */
> if (unlikely(start >= bound || end > bound || start > end))
> @@ -780,7 +779,8 @@ static void zram_make_request(struct request_queue *queue, struct bio *bio)
> if (unlikely(!init_done(zram)))
> goto error;
>
> - if (!valid_io_request(zram, bio)) {
> + if (!valid_io_request(zram, bio->bi_iter.bi_sector,
> + bio->bi_iter.bi_size)) {
> atomic64_inc(&zram->stats.invalid_io);
> goto error;
> }
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2014-10-21 14:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-21 7:27 [PATCH v3 0/3] zram: add rw_page implementation for zram and clean up unnecessary parameter karam.lee
2014-10-21 7:27 ` [PATCH v3 1/3] zram: remove bio parameter from zram_bvec_rw() karam.lee
2014-10-21 14:08 ` Jerome Marchand
2014-10-21 7:27 ` [PATCH v3 2/3] zram: change parameter from vaild_io_request() karam.lee
2014-10-21 14:09 ` Jerome Marchand [this message]
2014-10-21 7:27 ` [PATCH v3 3/3] zram: implement rw_page operation of zram karam.lee
2014-10-21 13:57 ` Jerome Marchand
2014-10-22 1:28 ` karam.lee
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=5446690D.3000909@redhat.com \
--to=jmarchan@redhat.com \
--cc=karam.lee@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew.r.wilcox@intel.com \
--cc=minchan@kernel.org \
--cc=ngupta@vflare.org \
--cc=seungho1.park@lge.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.