lkml.org 
[lkml]   [2014]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] zram: correct offset usage in zram_bio_discard
On (04/22/14 11:14), Weijie Yang wrote:
>
> we want to skip the logical block which is partially covered by
> the discard bio, so check the remaining size and subtract it if
> there is a need to goto the next logical block.
>

looks sane.

-ss

> This patch corrects the offset usage in zram_bio_discard.
>
> Signed-off-by: Weijie Yang <weijie.yang@samsung.com>
> ---
> drivers/block/zram/zram_drv.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
> index 9849b52..48eccb3 100644
> --- a/drivers/block/zram/zram_drv.c
> +++ b/drivers/block/zram/zram_drv.c
> @@ -572,10 +572,10 @@ static void zram_bio_discard(struct zram *zram, u32 index,
> * skipping this logical block is appropriate here.
> */
> if (offset) {
> - if (n < offset)
> + if (n <= (PAGE_SIZE - offset))
> return;
>
> - n -= offset;
> + n -= (PAGE_SIZE - offset);
> index++;
> }
>
> --
> 1.7.10.4
>
>


\
 
 \ /
  Last update: 2014-04-22 11:41    [W:0.059 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site