From d9b20bed7010c7d1327b7eb60235b118fb4e62bd Mon Sep 17 00:00:00 2001
From: nikita <nikita>
Date: Sat, 18 Oct 2008 17:11:31 +0000
Subject: [PATCH] Wrap kms updates into a helper function. b=16450

---
 lustre/ChangeLog       | 5 +++++
 lustre/include/obd.h   | 6 ++++++
 lustre/lov/lov_merge.c | 4 ++--
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/lustre/ChangeLog b/lustre/ChangeLog
index 2c214dfff9..e601ff318d 100644
--- a/lustre/ChangeLog
+++ b/lustre/ChangeLog
@@ -1581,6 +1581,11 @@ Description: Add lockdep annotations to llog code.
 Details    : Use appropriately tagged _nested() locking calls in the places
 	     where llog takes more than one ->lgh_lock lock.
 	
+Severity   : minor
+Bugzilla   : 16450
+Description: Add loi_kms_set().
+Details    : Wrap kms updates into a helper function.
+	
 --------------------------------------------------------------------------------
 
 2007-08-10         Cluster File Systems, Inc. <info@clusterfs.com>
diff --git a/lustre/include/obd.h b/lustre/include/obd.h
index 55f1d26aa2..cef96dbe17 100644
--- a/lustre/include/obd.h
+++ b/lustre/include/obd.h
@@ -107,6 +107,12 @@ struct lov_oinfo {                 /* per-stripe data structure */
         struct osc_async_rc     loi_ar;
 };
 
+static inline void loi_kms_set(struct lov_oinfo *oinfo, __u64 kms)
+{
+        oinfo->loi_kms = kms;
+        oinfo->loi_kms_valid = 1;
+}
+
 static inline void loi_init(struct lov_oinfo *loi)
 {
         CFS_INIT_LIST_HEAD(&loi->loi_read_lop.lop_pending);
diff --git a/lustre/lov/lov_merge.c b/lustre/lov/lov_merge.c
index b067ff3cec..47e87e0fb5 100644
--- a/lustre/lov/lov_merge.c
+++ b/lustre/lov/lov_merge.c
@@ -136,7 +136,7 @@ int lov_adjust_kms(struct obd_export *exp, struct lov_stripe_md *lsm,
                                "stripe %d KMS %sing "LPU64"->"LPU64"\n",
                                stripe, kms > loi->loi_kms ? "increas":"shrink",
                                loi->loi_kms, kms);
-                        loi->loi_kms = loi->loi_lvb.lvb_size = kms;
+                        loi_kms_set(loi, loi->loi_lvb.lvb_size = kms);
                 }
                 RETURN(0);
         }
@@ -149,7 +149,7 @@ int lov_adjust_kms(struct obd_export *exp, struct lov_stripe_md *lsm,
         CDEBUG(D_INODE, "stripe %d KMS %sincreasing "LPU64"->"LPU64"\n",
                stripe, kms > loi->loi_kms ? "" : "not ", loi->loi_kms, kms);
         if (kms > loi->loi_kms)
-                loi->loi_kms = kms;
+                loi_kms_set(loi, kms);
 
         RETURN(0);
 }
-- 
GitLab