Whamcloud - gitweb
LU-1526 utils: Supply default MDT index
authorJames Simmons <uja.ornl@gmail.com>
Thu, 18 Oct 2012 12:26:16 +0000 (08:26 -0400)
committerOleg Drokin <green@whamcloud.com>
Mon, 29 Oct 2012 06:01:46 +0000 (02:01 -0400)
To prepare for DNE indexing has become a requirement
for MDTs and with the latest lustre you can't mount
a MDT that was not formated with a index. While mount
has this requirement mkfs.lustre has a bug that allows
you to format a MDS without a index and not even warn
the user. At the same time mkfs.lustre has to handle
the case were a user will not supply a index since it
was not required in earlier lustre releases. This patch
address this problem by supplying a default index of
zero for the MDT if no index is supplied to mkfs.lustre
and warns the user they must supply a index in the
future.

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: I45932321885856d97b10630a0667e8338822b199
Reviewed-on: http://review.whamcloud.com/4293
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Li Wei <liwei@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/utils/mkfs_lustre.c

index 392e4f1..2e24134 100644 (file)
@@ -639,11 +639,17 @@ int main(int argc, char *const argv[])
                 goto out;
         }
 
-       if (IS_OST(ldd) && (mop.mo_ldd.ldd_flags & LDD_F_NEED_INDEX))
+       if (mop.mo_ldd.ldd_flags & LDD_F_NEED_INDEX)
                fprintf(stderr, "warning: %s: for Lustre 2.4 and later, the "
                        "target index must be specified with --index\n",
                        mop.mo_device);
 
+       /* If no index is supplied for MDT by default set index to zero */
+       if (IS_MDT(ldd) && (ldd->ldd_svindex == INDEX_UNASSIGNED)) {
+               mop.mo_ldd.ldd_flags &= ~LDD_F_NEED_INDEX;
+               mop.mo_ldd.ldd_svindex = 0;
+       }
+
 #if 0
         /*
          * Comment out these 2 checks temporarily, since for multi-MDSes