Whamcloud - gitweb
Branch HEAD
authorscjody <scjody>
Sat, 31 Mar 2007 00:14:39 +0000 (00:14 +0000)
committerscjody <scjody>
Sat, 31 Mar 2007 00:14:39 +0000 (00:14 +0000)
Add support for the ldiskfs2 fstype.

b=11981
r=adilger
r=nathan

lustre/include/lustre_disk.h
lustre/obdclass/obd_mount.c
lustre/tests/test-framework.sh
lustre/utils/mkfs_lustre.c
lustre/utils/module_setup.sh

index 26ff49d..0cc200a 100644 (file)
@@ -57,6 +57,7 @@ enum ldd_mount_type {
         LDD_MT_LDISKFS,
         LDD_MT_SMFS,   
         LDD_MT_REISERFS,
+        LDD_MT_LDISKFS2,
         LDD_MT_LAST
 };
        
@@ -67,6 +68,7 @@ static inline char *mt_str(enum ldd_mount_type mt)
                 "ldiskfs",
                 "smfs",
                 "reiserfs",
+                "ldiskfs2",
         };
         return mount_type_string[mt];
 }
index 33d2d5d..30782b7 100644 (file)
@@ -1214,11 +1214,17 @@ static struct vfsmount *server_kernel_mount(struct super_block *sb)
         if (IS_ERR(mnt)) {
                 rc = PTR_ERR(mnt);
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
-                CERROR("premount %s:%#lx ldiskfs failed (%d), is the ldiskfs "
-                       "module available?\n", lmd->lmd_dev, s_flags, rc);
-                GOTO(out_free, rc);
+                /* 2.6 kernels: if ldiskfs fails, try ldiskfs2 */
+                mnt = ll_kern_mount("ldiskfs2", s_flags, lmd->lmd_dev, 0);
+                if (IS_ERR(mnt)) {
+                        int rc2 = PTR_ERR(mnt);
+                        CERROR("premount %s:%#lx ldiskfs failed: %d, ldiskfs2 "
+                               "failed: %d.  Is the ldiskfs module available?\n",
+                               lmd->lmd_dev, s_flags, rc, rc2);
+                        GOTO(out_free, rc);
+                }
 #else
-                /* If ldisk fails, try ext3 */
+                /* 2.4 kernels: if ldiskfs fails, try ext3 */
                 mnt = ll_kern_mount("ext3", s_flags, lmd->lmd_dev, 0);
                 if (IS_ERR(mnt)) {
                         rc = PTR_ERR(mnt);
index b9e3df4..17bea48 100644 (file)
@@ -75,7 +75,7 @@ init_test_env() {
 
 case `uname -r` in
 2.4.*) EXT=".o"; USE_QUOTA=no; FSTYPE=ext3 ;;
-    *) EXT=".ko"; USE_QUOTA=yes; FSTYPE=ldiskfs ;;
+    *) EXT=".ko"; USE_QUOTA=yes; [ "$FSTYPE" ] || FSTYPE=ldiskfs ;;
 esac
 
 load_module() {
@@ -117,6 +117,7 @@ load_modules() {
     load_module lov/lov
     load_module mds/mds
     [ "$FSTYPE" = "ldiskfs" ] && load_module ldiskfs/ldiskfs
+    [ "$FSTYPE" = "ldiskfs2" ] && load_module ldiskfs/ldiskfs2
     load_module lvfs/fsfilt_$FSTYPE
     load_module ost/ost
     load_module obdfilter/obdfilter
@@ -599,21 +600,23 @@ cleanupall() {
 }
 
 formatall() {
+    [ "$FSTYPE" ] && FSTYPE_OPT="--backfstype $FSTYPE"
+
     stopall
     # We need ldiskfs here, may as well load them all
     load_modules
     echo Formatting mds, osts
     if $VERBOSE; then
-        add mds $MDS_MKFS_OPTS --reformat $MDSDEV || exit 10
+        add mds $MDS_MKFS_OPTS $FSTYPE_OPT --reformat $MDSDEV || exit 10
     else
-        add mds $MDS_MKFS_OPTS --reformat $MDSDEV > /dev/null || exit 10
+        add mds $MDS_MKFS_OPTS $FSTYPE_OPT --reformat $MDSDEV > /dev/null || exit 10
     fi
 
     for num in `seq $OSTCOUNT`; do
         if $VERBOSE; then
-            add ost$num $OST_MKFS_OPTS --reformat `ostdevname $num` || exit 10
+            add ost$num $OST_MKFS_OPTS $FSTYPE_OPT --reformat `ostdevname $num` || exit 10
         else
-            add ost$num $OST_MKFS_OPTS --reformat `ostdevname $num` > /dev/null || exit 10
+            add ost$num $OST_MKFS_OPTS $FSTYPE_OPT --reformat `ostdevname $num` > /dev/null || exit 10
         fi
     done
 }
index 9c9f381..a2c4021 100644 (file)
@@ -59,7 +59,6 @@
 /* used to describe the options to format the lustre disk, not persistent */
 struct mkfs_opts {
         struct lustre_disk_data mo_ldd; /* to be written in MOUNT_DATA_FILE */
-        char  mo_mount_type_string[20]; /* "ext3", "ldiskfs", ... */
         char  mo_device[128];           /* disk device name */
         char  mo_mkfsopts[128];         /* options to the backing-store mkfs */
         char  mo_loopdev[128];          /* in case a loop dev is needed */
@@ -448,7 +447,8 @@ int make_lustre_backfs(struct mkfs_opts *mop)
         }
 
         if ((mop->mo_ldd.ldd_mount_type == LDD_MT_EXT3) ||
-            (mop->mo_ldd.ldd_mount_type == LDD_MT_LDISKFS)) {
+            (mop->mo_ldd.ldd_mount_type == LDD_MT_LDISKFS) ||
+            (mop->mo_ldd.ldd_mount_type == LDD_MT_LDISKFS2)) {
                 __u64 device_sz = mop->mo_device_sz;
 
                 /* we really need the size */
@@ -1280,7 +1280,8 @@ int main(int argc, char *const argv[])
         /* These are the permanent mount options (always included) */ 
         switch (ldd->ldd_mount_type) {
         case LDD_MT_EXT3:
-        case LDD_MT_LDISKFS: {
+        case LDD_MT_LDISKFS:
+        case LDD_MT_LDISKFS2: {
                 sprintf(always_mountopts, "errors=remount-ro");
                 if (IS_MDT(ldd) || IS_MGS(ldd))
                         strcat(always_mountopts,
@@ -1291,7 +1292,8 @@ int main(int argc, char *const argv[])
                    if mounted with a kernel that doesn't include the CFS 
                    patches! */
                 if (IS_OST(ldd) && 
-                    ldd->ldd_mount_type == LDD_MT_LDISKFS) {
+                    (ldd->ldd_mount_type == LDD_MT_LDISKFS ||
+                     ldd->ldd_mount_type == LDD_MT_LDISKFS2)) {
                         strcat(default_mountopts, ",extents,mballoc");
                 }
                 break;
index 0180a00..2aa2f59 100755 (executable)
@@ -32,6 +32,7 @@ cp -u ../lov/lov.$EXT $MDIR
 cp -u ../mds/mds.$EXT $MDIR
 cp -u ../lvfs/$FSFLT.$EXT $MDIR
 [ $KVER == "26" ] && cp -u ../ldiskfs/ldiskfs.$EXT $MDIR
+[ $KVER == "26" ] && cp -u ../ldiskfs2/ldiskfs2.$EXT $MDIR
 cp -u ../ost/ost.$EXT $MDIR
 cp -u ../obdfilter/obdfilter.$EXT $MDIR
 cp -u ../llite/lustre.$EXT $MDIR