[2/2] lightnvm: fix request intersection locking in rrpc
diff mbox

Message ID 1454322873-28687-2-git-send-email-javier@javigon.com
State New
Headers show

Commit Message

=?UTF-8?q?Javier=20Gonz=C3=A1lez?= Feb. 1, 2016, 10:34 a.m. UTC
This patch fixes an error on the calculation of intersecting logical
addresses; it contemplates the case where a new request including
several addresses intersects with a single locked address. This case is
typical when multiple pages are sent in a new request, while GC - which
at the moment sends one address at the time - is running.

Signed-off-by: Javier González <javier@cnexlabs.com>
---
 drivers/lightnvm/rrpc.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Matias Bjørling Feb. 3, 2016, 8:53 a.m. UTC | #1
On 02/01/2016 11:34 AM, Javier González wrote:
> This patch fixes an error on the calculation of intersecting logical
> addresses; it contemplates the case where a new request including
> several addresses intersects with a single locked address. This case is
> typical when multiple pages are sent in a new request, while GC - which
> at the moment sends one address at the time - is running.
> 
> Signed-off-by: Javier González <javier@cnexlabs.com>
> ---
>  drivers/lightnvm/rrpc.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/lightnvm/rrpc.h b/drivers/lightnvm/rrpc.h
> index c27283a..3989d65 100644
> --- a/drivers/lightnvm/rrpc.h
> +++ b/drivers/lightnvm/rrpc.h
> @@ -174,8 +174,7 @@ static inline sector_t rrpc_get_sector(sector_t laddr)
>  static inline int request_intersects(struct rrpc_inflight_rq *r,
>  				sector_t laddr_start, sector_t laddr_end)
>  {
> -	return (laddr_end >= r->l_start && laddr_end <= r->l_end) &&
> -		(laddr_start >= r->l_start && laddr_start <= r->l_end);
> +	return (laddr_end >= r->l_start) && (laddr_start <= r->l_end);
>  }
>  
>  static int __rrpc_lock_laddr(struct rrpc *rrpc, sector_t laddr,
> 
Thanks, applied for next -rc.
--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/drivers/lightnvm/rrpc.h b/drivers/lightnvm/rrpc.h
index c27283a..3989d65 100644
--- a/drivers/lightnvm/rrpc.h
+++ b/drivers/lightnvm/rrpc.h
@@ -174,8 +174,7 @@  static inline sector_t rrpc_get_sector(sector_t laddr)
 static inline int request_intersects(struct rrpc_inflight_rq *r,
 				sector_t laddr_start, sector_t laddr_end)
 {
-	return (laddr_end >= r->l_start && laddr_end <= r->l_end) &&
-		(laddr_start >= r->l_start && laddr_start <= r->l_end);
+	return (laddr_end >= r->l_start) && (laddr_start <= r->l_end);
 }
 
 static int __rrpc_lock_laddr(struct rrpc *rrpc, sector_t laddr,