Whamcloud - gitweb
b=19544
authoranserper <anserper>
Wed, 15 Jul 2009 13:28:47 +0000 (13:28 +0000)
committeranserper <anserper>
Wed, 15 Jul 2009 13:28:47 +0000 (13:28 +0000)
i=Robert Read
i=Dmitry Zogin

move to static on-stack allocations

lustre/lvfs/lustre_quota_fmt.c
lustre/lvfs/lustre_quota_fmt.h

index 8e0f68c..be5680c 100644 (file)
@@ -585,7 +585,7 @@ static int lustre_write_dquot(struct lustre_dquot *dquot,
         loff_t offset;
         ssize_t ret;
         int dqblk_sz = lustre_disk_dqblk_sz[version];
-        char ddquot[dqblk_sz];
+        char ddquot[sizeof(union lustre_disk_dqblk_un)];
 
         ret = mem2diskdqb(ddquot, &dquot->dq_dqb, dquot->dq_id, version);
         if (ret < 0)
@@ -836,7 +836,7 @@ int lustre_read_dquot(struct lustre_dquot *dquot)
                 memset(&dquot->dq_dqb, 0, sizeof(struct lustre_mem_dqblk));
                 ret = offset;
         } else {
-                char ddquot[dqblk_sz];
+                char ddquot[sizeof(union lustre_disk_dqblk_un)];
 
                 dquot->dq_off = offset;
                 fs = get_fs();
index ab43160..434c24f 100644 (file)
@@ -123,6 +123,11 @@ struct lustre_disk_dqblk_v2 {
 #define GETENTRIES(buf,version) ((version == LUSTRE_QUOTA_V1) ? \
                                 GETENTRIES_V1(buf) : GETENTRIES_V2(buf))
 
+union lustre_disk_dqblk_un {
+        struct lustre_disk_dqblk    v1;
+        struct lustre_disk_dqblk_v2 v2;
+};
+
 /*
  * Here are header structures as written on disk and their in-memory copies
  */