Skip to contentSkip to conversation

Staging: lustre: lnet: lnet: router.c : fix 80 char limit

PATCH In review Redha Gouicem 2 participants 4 messages Mar 18, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Staging: lustre: lnet: lnet: router.c : fix 80 char limit

This fixes lines longer than 80 char which are not debug or error messages.

---
 drivers/staging/lustre/lnet/lnet/router.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/lustre/lnet/lnet/router.c +4 -2
index c0a6aeb..89a29b7 100644
@@ -107,7 +107,8 @@ lnet_peers_start_down(void)
 }
 
 void
-lnet_notify_locked(lnet_peer_t *lp, int notifylnd, int alive, unsigned long when)
+lnet_notify_locked(lnet_peer_t *lp, int notifylnd, int alive,
+		   unsigned long when)
 {
 	if (time_before(when, lp->lp_timestamp)) { /* out of date information */
 		CDEBUG(D_NET, "Out of date\n");
@@ -1435,7 +1436,8 @@ int
 lnet_rtrpools_alloc(int im_a_router)
 {
 	lnet_rtrbufpool_t *rtrp;
-	int	large_pages = (LNET_MTU + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
+	int	large_pages = (LNET_MTU + PAGE_CACHE_SIZE - 1)
+	  >> PAGE_CACHE_SHIFT;
 	int	small_pages = 1;
 	int	nrb_tiny;
 	int	nrb_small;
Signature · 1 line
1.9.1
#1 lore raw

PATCH 2/2 Staging: lustre: lnet: lnet: router.c: fix useless statements

This patch removes useless returns and elses.

---
 drivers/staging/lustre/lnet/lnet/router.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)
drivers/staging/lustre/lnet/lnet/router.c +4 -11
index 89a29b7..6fe79e2 100644
@@ -270,7 +270,6 @@ static void lnet_shuffle_seed(void)
 	do_gettimeofday(&tv);
 	cfs_srand(tv.tv_sec ^ seed[0], tv.tv_usec ^ seed[1]);
 	seeded = 1;
-	return;
 }
 
 /* NB expects LNET_LOCK held */
@@ -357,11 +356,10 @@ lnet_add_route(__u32 net, unsigned int hops, lnet_nid_t gateway,
 
 		if (rc == -EHOSTUNREACH) { /* gateway is not on a local net */
 			return 0;	/* ignore the route entry */
-		} else {
-			CERROR("Error %d creating route %s %d %s\n", rc,
-			       libcfs_net2str(net), hops,
-			       libcfs_nid2str(gateway));
-		}
+		CERROR("Error %d creating route %s %d %s\n", rc,
+		       libcfs_net2str(net), hops,
+		       libcfs_nid2str(gateway));
+
 		return rc;
 	}
 
@@ -607,7 +605,6 @@ lnet_swap_pinginfo(lnet_ping_info_t *info)
 		__swab64s(&stat->ns_nid);
 		__swab32s(&stat->ns_status);
 	}
-	return;
 }
 
 /**
@@ -1011,7 +1008,6 @@ lnet_ping_router_locked(lnet_peer_t *rtr)
 	}
 
 	lnet_peer_decref_locked(rtr);
-	return;
 }
 
 int
@@ -1084,7 +1080,6 @@ lnet_router_checker_stop(void)
 
 	rc = LNetEQFree(the_lnet.ln_rc_eqh);
 	LASSERT(rc == 0);
-	return;
 }
 
 static void
@@ -1581,7 +1576,6 @@ EXPORT_SYMBOL(lnet_notify);
 void
 lnet_get_tunables(void)
 {
-	return;
 }
 
 #else
@@ -1670,7 +1664,6 @@ lnet_router_checker(void)
 	lnet_net_unlock(0);
 
 	running = 0; /* lock only needed for the recursion check */
-	return;
 }
 
 /* NB lnet_peers_start_down depends on me,
Signature · 1 line
1.9.1
maintainer
#2 lore raw

Re: [PATCH 2/2] Staging: lustre: lnet: lnet: router.c: fix useless statements

Quoted 25 lines · Redha Gouicem

This patch removes useless returns and elses.

---
 drivers/staging/lustre/lnet/lnet/router.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)
drivers/staging/lustre/lnet/lnet/router.c +0 -3
index 89a29b7..6fe79e2 100644
@@ -270,7 +270,6 @@ static void lnet_shuffle_seed(void)
 	do_gettimeofday(&tv);
 	cfs_srand(tv.tv_sec ^ seed[0], tv.tv_usec ^ seed[1]);
 	seeded = 1;
-	return;
 }
 
 /* NB expects LNET_LOCK held */
@@ -357,11 +356,10 @@ lnet_add_route(__u32 net, unsigned int hops, lnet_nid_t gateway,
 
 		if (rc == -EHOSTUNREACH) { /* gateway is not on a local net */
 			return 0;	/* ignore the route entry */
-		} else {
-			CERROR("Error %d creating route %s %d %s\n", rc,

drivers/staging/lustre/lnet/lnet/router.c lnet_add_route(__u32 net, unsigned int hops, lnet_nid_t gateway, · line 365

Quoted 10 lines
drivers/staging/lustre/lnet/lnet/router.c +4 -3
-			       libcfs_net2str(net), hops,
-			       libcfs_nid2str(gateway));
-		}
+		CERROR("Error %d creating route %s %d %s\n", rc,
+		       libcfs_net2str(net), hops,
+		       libcfs_nid2str(gateway));
+
 		return rc;
 	}
 

This change broke the build :(

Please always test build your changes, cna you fix it up and resend?

thanks,

greg k-h

maintainer
#3 lore raw
In reply to Redha Gouicem
Quoted 22 lines · Redha Gouicem

This fixes lines longer than 80 char which are not debug or error messages.

---
 drivers/staging/lustre/lnet/lnet/router.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/lustre/lnet/lnet/router.c +2 -1
index c0a6aeb..89a29b7 100644
@@ -107,7 +107,8 @@ lnet_peers_start_down(void)
 }
 
 void
-lnet_notify_locked(lnet_peer_t *lp, int notifylnd, int alive, unsigned long when)
+lnet_notify_locked(lnet_peer_t *lp, int notifylnd, int alive,
+		   unsigned long when)
 {
 	if (time_before(when, lp->lp_timestamp)) { /* out of date information */
 		CDEBUG(D_NET, "Out of date\n");

drivers/staging/lustre/lnet/lnet/router.c int · line 1440

Quoted 6 lines
drivers/staging/lustre/lnet/lnet/router.c +2 -1
@@ -1435,7 +1436,8 @@ int
 lnet_rtrpools_alloc(int im_a_router)
 {
 	lnet_rtrbufpool_t *rtrp;
-	int	large_pages = (LNET_MTU + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
+	int	large_pages = (LNET_MTU + PAGE_CACHE_SIZE - 1)
+	  >> PAGE_CACHE_SHIFT;

This last change doesn't really work in that it makes the code harder to read now. Yeah, the original code is a mess, one way to fix this would be to not do the assignment here in the variable initializer, but move it below in the code to be something like:

	int large_pages;

....

	large_pages = (LNET_MTU + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;

Can you fix this patch up to look like this and resend?

thanks,

greg k-h