From: Jinshan Xiong Date: Fri, 21 Mar 2014 18:49:41 +0000 (-0700) Subject: LU-4860 lov: Handle the case of stripe size is not power 2 X-Git-Tag: 2.5.58~15 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=57d8f6dadafa655d47bda62ffe1e13225abadb26;p=fs%2Flustre-release.git LU-4860 lov: Handle the case of stripe size is not power 2 Calculate the end of current stripe correctly when the stripe size is not power 2. Signed-off-by: Jinshan Xiong Change-Id: Ic250298b668d3bc32ed14d8390b897578a9c89a2 Reviewed-on: http://review.whamcloud.com/9882 Tested-by: Jenkins Reviewed-by: Bobi Jam Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/lov/lov_page.c b/lustre/lov/lov_page.c index 75ded96..3960438 100644 --- a/lustre/lov/lov_page.c +++ b/lustre/lov/lov_page.c @@ -70,7 +70,9 @@ static int lov_raid0_page_is_under_lock(const struct lu_env *env, unsigned int pps; /* pages per stripe */ ENTRY; - CDEBUG(D_READA, "*max_index = %lu, nr = %d\n", index, r0->lo_nr); + CDEBUG(D_READA, DFID "*max_index = %lu, nr = %d\n", + PFID(lu_object_fid(lov2lu(loo))), index, r0->lo_nr); + if (index == 0) /* the page is not covered by any lock */ RETURN(0); @@ -85,7 +87,13 @@ static int lov_raid0_page_is_under_lock(const struct lu_env *env, /* calculate the end of current stripe */ pps = loo->lo_lsm->lsm_stripe_size >> PAGE_CACHE_SHIFT; - index = ((slice->cpl_index + pps) & ~(pps - 1)) - 1; + index = slice->cpl_index + pps - slice->cpl_index % pps - 1; + + CDEBUG(D_READA, DFID "*max_index = %lu, index = %lu, pps = %u, " + "stripe_size = %u, stripe no = %u, page index = %lu\n", + PFID(lu_object_fid(lov2lu(loo))), *max_index, index, pps, + loo->lo_lsm->lsm_stripe_size, lov_page_stripe(slice->cpl_page), + slice->cpl_index); /* never exceed the end of the stripe */ *max_index = min_t(pgoff_t, *max_index, index);