Whamcloud - gitweb
Merge b_md into HEAD
[fs/lustre-release.git] / lustre / mds / mds_lov.c
index b548792..fef9a0d 100644 (file)
@@ -2,16 +2,25 @@
  * vim:expandtab:shiftwidth=8:tabstop=8:
  *
  *  linux/mds/mds_lov.c
- *
  *  Lustre Metadata Server (mds) handling of striped file data
  *
- *  Copyright (C) 2001, 2002 Cluster File Systems, Inc.
+ *  Copyright (C) 2001-2003 Cluster File Systems, Inc.
+ *   Author: Peter Braam <braam@clusterfs.com>
+ *
+ *   This file is part of Lustre, http://www.lustre.org.
  *
- *  This code is issued under the GNU General Public License.
- *  See the file COPYING in this distribution
+ *   Lustre is free software; you can redistribute it and/or
+ *   modify it under the terms of version 2 of the GNU General Public
+ *   License as published by the Free Software Foundation.
  *
- *  by Peter Braam <braam@clusterfs.com> &
+ *   Lustre is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
  *
+ *   You should have received a copy of the GNU General Public License
+ *   along with Lustre; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #define EXPORT_SYMTAB
@@ -35,7 +44,7 @@ void lov_packdesc(struct lov_desc *ld)
 }
 
 int mds_set_lovdesc(struct obd_device *obd, struct lov_desc *desc,
-                    obd_uuid_t *uuidarray)
+                    struct obd_uuid *uuidarray)
 {
         struct mds_obd *mds = &obd->u.mds;
         struct obd_run_ctxt saved;
@@ -99,11 +108,11 @@ int mds_set_lovdesc(struct obd_device *obd, struct lov_desc *desc,
 #warning FIXME: if there is an existing LOVTGTS, verify existing UUIDs same
         rc = 0;
         for (i = 0; i < tgt_count ; i++) {
-                rc = lustre_fwrite(f, uuidarray[i],
+                rc = lustre_fwrite(f, uuidarray[i].uuid,
                                    sizeof(uuidarray[i]), &f->f_pos);
                 if (rc != sizeof(uuidarray[i])) {
                         CERROR("cannot write LOV UUID %s (%d)\n",
-                               uuidarray[i], i);
+                               uuidarray[i].uuid, i);
                         if (rc >= 0)
                                 rc = -EIO;
                         break;
@@ -148,7 +157,7 @@ out:
         return rc;
 }
 
-int mds_get_lovtgts(struct mds_obd *mds, int tgt_count,obd_uuid_t *uuidarray)
+int mds_get_lovtgts(struct mds_obd *mds, int tgt_count,struct obd_uuid *uuidarray)
 {
         struct obd_run_ctxt saved;
         struct file *f;
@@ -188,11 +197,10 @@ int mds_iocontrol(unsigned int cmd, struct lustre_handle *conn,
         struct obd_device *obd = class_conn2obd(conn);
         struct obd_ioctl_data *data = karg;
         struct lov_desc *desc;
-        obd_uuid_t *uuidarray;
+        struct obd_uuid *uuidarray;
         int count;
         int rc;
 
-
         switch (cmd) {
         case OBD_IOC_LOV_SET_CONFIG:
                 desc = (struct lov_desc *)data->ioc_inlbuf1;
@@ -202,7 +210,7 @@ int mds_iocontrol(unsigned int cmd, struct lustre_handle *conn,
                 }
 
                 count = desc->ld_tgt_count;
-                uuidarray = (obd_uuid_t *)data->ioc_inlbuf2;
+                uuidarray = (struct obd_uuid *)data->ioc_inlbuf2;
                 if (sizeof(*uuidarray) * count != data->ioc_inllen2) {
                         CERROR("UUID array size wrong\n");
                         RETURN(-EINVAL);
@@ -218,7 +226,7 @@ int mds_iocontrol(unsigned int cmd, struct lustre_handle *conn,
                 }
 
                 count = desc->ld_tgt_count;
-                uuidarray = (obd_uuid_t *)data->ioc_inlbuf2;
+                uuidarray = (struct obd_uuid *)data->ioc_inlbuf2;
                 if (sizeof(*uuidarray) * count != data->ioc_inllen2) {
                         CERROR("UUID array size wrong\n");
                         RETURN(-EINVAL);
@@ -231,9 +239,15 @@ int mds_iocontrol(unsigned int cmd, struct lustre_handle *conn,
                 rc = mds_get_lovtgts(&obd->u.mds, desc->ld_tgt_count, uuidarray);
 
                 RETURN(rc);
+
+            case OBD_IOC_SET_READONLY:
+                CERROR("setting device %s read-only\n",
+                       ll_bdevname(obd->u.mds.mds_sb->s_dev));
+                dev_set_rdonly(obd->u.mds.mds_sb->s_dev, 2);
+                RETURN(0);
+
         default:
                 RETURN(-EINVAL);
         }
-
         RETURN(0);
 }