Skip to contentSkip to conversation

Staging: lustre: lov: Pull assignments out of function call

PATCH In review Bhumika Goyal 2 participants 3 messages Feb 16, 2016 – Feb 17, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: lustre: lov: Pull assignments out of function call

Assignments in function call arguments are undesirable. So pull such assignments out before function call.
Made a coccinelle script to detect such cases:
@@
expression fn,b,d;
@@
* fn(...,d=b,...);

---
 drivers/staging/lustre/lustre/lov/lov_merge.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/lov/lov_merge.c +2 -1
index 97115be..029cd4d 100644
@@ -129,7 +129,8 @@ int lov_adjust_kms(struct obd_export *exp, struct lov_stripe_md *lsm,
 			       "stripe %d KMS %sing %llu->%llu\n",
 			       stripe, kms > loi->loi_kms ? "increase":"shrink",
 			       loi->loi_kms, kms);
-			loi_kms_set(loi, loi->loi_lvb.lvb_size = kms);
+			loi->loi_lvb.lvb_size = kms;
+			loi_kms_set(loi, loi->loi_lvb.lvb_size);
 		}
 		return 0;
 	}
Signature · 1 line
1.9.1
#1 lore raw
Quoted 7 lines · Bhumika Goyal

Assignments in function call arguments are undesirable. So pull such assignments out before function call.
Made a coccinelle script to detect such cases:
@@
expression fn,b,d;
@@
* fn(...,d=b,...);

The script looks fine now.

julia

Quoted 30 lines
---
 drivers/staging/lustre/lustre/lov/lov_merge.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/lov/lov_merge.c +2 -2
index 97115be..029cd4d 100644
@@ -129,7 +129,8 @@ int lov_adjust_kms(struct obd_export *exp, struct lov_stripe_md *lsm,
 			       "stripe %d KMS %sing %llu->%llu\n",
 			       stripe, kms > loi->loi_kms ? "increase":"shrink",
 			       loi->loi_kms, kms);
-			loi_kms_set(loi, loi->loi_lvb.lvb_size = kms);
+			loi->loi_lvb.lvb_size = kms;
+			loi_kms_set(loi, loi->loi_lvb.lvb_size);
 		}
 		return 0;
 	}
--

1.9.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1455651118-18615-1-git-send-email-bhumirks%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw
Quoted 10 lines · Julia Lawall
Quoted 7 lines · Bhumika Goyal

Assignments in function call arguments are undesirable. So pull such assignments out before function call.
Made a coccinelle script to detect such cases:
@@
expression fn,b,d;
@@
* fn(...,d=b,...);

Quoted 4 lines

The script looks fine now.

julia

Thanks for the input Julia.

Bhumika

Quoted 30 lines
Quoted 30 lines
---
 drivers/staging/lustre/lustre/lov/lov_merge.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/lov/lov_merge.c +2 -2
index 97115be..029cd4d 100644
@@ -129,7 +129,8 @@ int lov_adjust_kms(struct obd_export *exp, struct lov_stripe_md *lsm,
                             "stripe %d KMS %sing %llu->%llu\n",
                             stripe, kms > loi->loi_kms ? "increase":"shrink",
                             loi->loi_kms, kms);
-                     loi_kms_set(loi, loi->loi_lvb.lvb_size = kms);
+                     loi->loi_lvb.lvb_size = kms;
+                     loi_kms_set(loi, loi->loi_lvb.lvb_size);
              }
              return 0;
      }
--

1.9.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1455651118-18615-1-git-send-email-bhumirks%40gmail.com.
For more options, visit https://groups.google.com/d/optout.