Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 87ffe02c authored by Jinshan Xiong's avatar Jinshan Xiong Committed by Greg Kroah-Hartman
Browse files

staging: lustre: 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: default avatarJinshan Xiong <jinshan.xiong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4860
Reviewed-on: http://review.whamcloud.com/9882


Reviewed-by: default avatarBobi Jam <bobijam@gmail.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 91196c20
Loading
Loading
Loading
Loading
+9 −2
Original line number Original line Diff line number Diff line
@@ -65,7 +65,9 @@ static int lov_raid0_page_is_under_lock(const struct lu_env *env,
	pgoff_t index = *max_index;
	pgoff_t index = *max_index;
	unsigned int pps; /* pages per stripe */
	unsigned int pps; /* pages per stripe */


	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 */
	if (index == 0) /* the page is not covered by any lock */
		return 0;
		return 0;


@@ -80,7 +82,12 @@ static int lov_raid0_page_is_under_lock(const struct lu_env *env,


	/* calculate the end of current stripe */
	/* calculate the end of current stripe */
	pps = loo->lo_lsm->lsm_stripe_size >> PAGE_SHIFT;
	pps = loo->lo_lsm->lsm_stripe_size >> PAGE_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 */
	/* never exceed the end of the stripe */
	*max_index = min_t(pgoff_t, *max_index, index);
	*max_index = min_t(pgoff_t, *max_index, index);