All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: xen: use time_after_eq() instead of jiffies judgment
@ 2022-02-10  8:29 Qing Wang
  2022-02-10 14:55 ` Roger Pau Monné
  0 siblings, 1 reply; 2+ messages in thread
From: Qing Wang @ 2022-02-10  8:29 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Roger Pau Monné,
	Jens Axboe, xen-devel, linux-block, linux-kernel
  Cc: Wang Qing

From: Wang Qing <wangqing@vivo.com>

It is better to use time_xxx() directly instead of jiffies judgment
for understanding.

Signed-off-by: Wang Qing <wangqing@vivo.com>
---
 drivers/block/xen-blkback/blkback.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index d1e2646..aecc1f4
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -42,6 +42,7 @@
 #include <linux/delay.h>
 #include <linux/freezer.h>
 #include <linux/bitmap.h>
+#include <linux/jiffies.h>
 
 #include <xen/events.h>
 #include <xen/page.h>
@@ -134,8 +135,8 @@ module_param(log_stats, int, 0644);
 
 static inline bool persistent_gnt_timeout(struct persistent_gnt *persistent_gnt)
 {
-	return pgrant_timeout && (jiffies - persistent_gnt->last_used >=
-			HZ * pgrant_timeout);
+	return pgrant_timeout &&
+			time_after_eq(jiffies, persistent_gnt->last_used + HZ * pgrant_timeout);
 }
 
 #define vaddr(page) ((unsigned long)pfn_to_kaddr(page_to_pfn(page)))
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] block: xen: use time_after_eq() instead of jiffies judgment
  2022-02-10  8:29 [PATCH] block: xen: use time_after_eq() instead of jiffies judgment Qing Wang
@ 2022-02-10 14:55 ` Roger Pau Monné
  0 siblings, 0 replies; 2+ messages in thread
From: Roger Pau Monné @ 2022-02-10 14:55 UTC (permalink / raw)
  To: Qing Wang
  Cc: Konrad Rzeszutek Wilk, Jens Axboe, xen-devel, linux-block, linux-kernel

On Thu, Feb 10, 2022 at 12:29:23AM -0800, Qing Wang wrote:
> From: Wang Qing <wangqing@vivo.com>
> 
> It is better to use time_xxx() directly instead of jiffies judgment
> for understanding.
> 
> Signed-off-by: Wang Qing <wangqing@vivo.com>

Acked-by: Roger Pau Monné <roger.pau@citrix.com>

Doesn't look that different to me TBH, but if people find it easier.

Thanks, Roger.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-10 14:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-10  8:29 [PATCH] block: xen: use time_after_eq() instead of jiffies judgment Qing Wang
2022-02-10 14:55 ` Roger Pau Monné

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.