Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751928AbXLZPWs (ORCPT ); Wed, 26 Dec 2007 10:22:48 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751235AbXLZPWi (ORCPT ); Wed, 26 Dec 2007 10:22:38 -0500 Received: from mgw1.diku.dk ([130.225.96.91]:39622 "EHLO mgw1.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751223AbXLZPWh (ORCPT ); Wed, 26 Dec 2007 10:22:37 -0500 Date: Wed, 26 Dec 2007 16:21:37 +0100 (MET) From: Julia Lawall To: hpa@zytor.com, autofs@linux.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 1/4] fs/autofs: Use time_before, time_before_eq, etc. Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1646 Lines: 59 From: Julia Lawall The functions time_before, time_before_eq, time_after, and time_after_eq are more robust for comparing jiffies against other values. A simplified version of the semantic patch making this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @ change_compare_np @ expression E; @@ ( - jiffies <= E + time_before_eq(jiffies,E) | - jiffies >= E + time_after_eq(jiffies,E) | - jiffies < E + time_before(jiffies,E) | - jiffies > E + time_after(jiffies,E) ) @ include depends on change_compare_np @ @@ #include @ no_include depends on !include && change_compare_np @ @@ #include + #include // Signed-off-by: Julia Lawall --- diff -u -p linux-2.6/fs/autofs/dirhash.c linuxcopy/fs/autofs/dirhash.c --- linux-2.6/fs/autofs/dirhash.c 2006-11-30 19:05:26.000000000 +0100 +++ linuxcopy/fs/autofs/dirhash.c 2007-12-25 20:53:48.000000000 +0100 @@ -47,7 +47,7 @@ struct autofs_dir_ent *autofs_expire(str return NULL; /* No entries */ /* We keep the list sorted by last_usage and want old stuff */ ent = list_entry(dh->expiry_head.next, struct autofs_dir_ent, exp); - if (jiffies - ent->last_usage < timeout) + if (time_before(jiffies, ent->last_usage + timeout)) break; /* Move to end of list in case expiry isn't desirable */ autofs_update_usage(dh, ent); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/