Whamcloud - gitweb
b=14230
[fs/lustre-release.git] / lustre / mds / mds_lov.c
index 91dcd33..d4ec371 100644 (file)
@@ -26,9 +26,6 @@
  *   license text for more details.
  */
 
-#ifndef EXPORT_SYMTAB
-# define EXPORT_SYMTAB
-#endif
 #define DEBUG_SUBSYSTEM S_MDS
 
 #include <linux/module.h>
@@ -120,7 +117,6 @@ err_free_bitmap:
 
         RETURN(rc);
 }
-EXPORT_SYMBOL(mds_lov_init_objids);
 
 void mds_lov_destroy_objids(struct obd_device *obd)
 {
@@ -148,35 +144,6 @@ void mds_lov_destroy_objids(struct obd_device *obd)
         FREE_BITMAP(mds->mds_lov_page_dirty);
         EXIT;
 }
-EXPORT_SYMBOL(mds_lov_destroy_objids);
-
-void mds_lov_update_objids(struct obd_device *obd, struct lov_mds_md *lmm)
-{
-        struct mds_obd *mds = &obd->u.mds;
-        int j;
-        ENTRY;
-
-        /* if we create file without objects - lmm is NULL */
-        if (lmm == NULL)
-                return;
-
-        for (j = 0; j < le32_to_cpu(lmm->lmm_stripe_count); j++) {
-                int i = le32_to_cpu(lmm->lmm_objects[j].l_ost_idx);
-                obd_id id = le64_to_cpu(lmm->lmm_objects[j].l_object_id);
-                int page = i / OBJID_PER_PAGE();
-                int idx = i % OBJID_PER_PAGE();
-                obd_id *data = mds->mds_lov_page_array[page];
-
-                CDEBUG(D_INODE,"update last object for ost %d - new %llu"
-                               " old %llu\n", i, id, data[idx]);
-                if (id > data[idx]) {
-                        data[idx] = id;
-                        cfs_bitmap_set(mds->mds_lov_page_dirty, page);
-                }
-        }
-        EXIT;
-}
-EXPORT_SYMBOL(mds_lov_update_objids);
 
 static int mds_lov_read_objids(struct obd_device *obd)
 {
@@ -615,214 +582,6 @@ int mds_lov_disconnect(struct obd_device *obd)
         RETURN(rc);
 }
 
-int mds_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
-                  void *karg, void *uarg)
-{
-        static struct obd_uuid cfg_uuid = { .uuid = "config_uuid" };
-        struct obd_device *obd = exp->exp_obd;
-        struct mds_obd *mds = &obd->u.mds;
-        struct obd_ioctl_data *data = karg;
-        struct lvfs_run_ctxt saved;
-        int rc = 0;
-
-        ENTRY;
-        CDEBUG(D_IOCTL, "handling ioctl cmd %#x\n", cmd);
-
-        switch (cmd) {
-        case OBD_IOC_RECORD: {
-                char *name = data->ioc_inlbuf1;
-                struct llog_ctxt *ctxt;
-
-                if (mds->mds_cfg_llh)
-                        RETURN(-EBUSY);
-
-                ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
-                push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-                rc = llog_create(ctxt, &mds->mds_cfg_llh, NULL, name);
-                llog_ctxt_put(ctxt);
-                if (rc == 0)
-                        llog_init_handle(mds->mds_cfg_llh, LLOG_F_IS_PLAIN,
-                                         &cfg_uuid);
-                else
-                        mds->mds_cfg_llh = NULL;
-                pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-
-                RETURN(rc);
-        }
-
-        case OBD_IOC_ENDRECORD: {
-                if (!mds->mds_cfg_llh)
-                        RETURN(-EBADF);
-
-                push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-                rc = llog_close(mds->mds_cfg_llh);
-                pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-
-                mds->mds_cfg_llh = NULL;
-                RETURN(rc);
-        }
-
-        case OBD_IOC_CLEAR_LOG: {
-                char *name = data->ioc_inlbuf1;
-                struct llog_ctxt *ctxt;
-                if (mds->mds_cfg_llh)
-                        RETURN(-EBUSY);
-
-                ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
-                push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-                rc = llog_create(ctxt, &mds->mds_cfg_llh, NULL, name);
-                llog_ctxt_put(ctxt);
-                if (rc == 0) {
-                        llog_init_handle(mds->mds_cfg_llh, LLOG_F_IS_PLAIN,
-                                         NULL);
-
-                        rc = llog_destroy(mds->mds_cfg_llh);
-                        llog_free_handle(mds->mds_cfg_llh);
-                }
-                pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-
-                mds->mds_cfg_llh = NULL;
-                RETURN(rc);
-        }
-
-        case OBD_IOC_DORECORD: {
-                char *cfg_buf;
-                struct llog_rec_hdr rec;
-                if (!mds->mds_cfg_llh)
-                        RETURN(-EBADF);
-
-                rec.lrh_len = llog_data_len(data->ioc_plen1);
-
-                if (data->ioc_type == LUSTRE_CFG_TYPE) {
-                        rec.lrh_type = OBD_CFG_REC;
-                } else {
-                        CERROR("unknown cfg record type:%d \n", data->ioc_type);
-                        RETURN(-EINVAL);
-                }
-
-                OBD_ALLOC(cfg_buf, data->ioc_plen1);
-                if (cfg_buf == NULL)
-                        RETURN(-EINVAL);
-                rc = copy_from_user(cfg_buf, data->ioc_pbuf1, data->ioc_plen1);
-                if (rc) {
-                        OBD_FREE(cfg_buf, data->ioc_plen1);
-                        RETURN(rc);
-                }
-
-                push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-                rc = llog_write_rec(mds->mds_cfg_llh, &rec, NULL, 0,
-                                    cfg_buf, -1);
-                pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-
-                OBD_FREE(cfg_buf, data->ioc_plen1);
-                RETURN(rc);
-        }
-
-        case OBD_IOC_PARSE: {
-                struct llog_ctxt *ctxt =
-                        llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
-                push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-                rc = class_config_parse_llog(ctxt, data->ioc_inlbuf1, NULL);
-                pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-                llog_ctxt_put(ctxt);
-                if (rc)
-                        RETURN(rc);
-
-                RETURN(rc);
-        }
-
-        case OBD_IOC_DUMP_LOG: {
-                struct llog_ctxt *ctxt =
-                        llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
-                push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-                rc = class_config_dump_llog(ctxt, data->ioc_inlbuf1, NULL);
-                pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-                llog_ctxt_put(ctxt);
-                if (rc)
-                        RETURN(rc);
-
-                RETURN(rc);
-        }
-
-        case OBD_IOC_SYNC: {
-                CDEBUG(D_INFO, "syncing mds %s\n", obd->obd_name);
-                rc = fsfilt_sync(obd, obd->u.obt.obt_sb);
-                RETURN(rc);
-        }
-
-        case OBD_IOC_SET_READONLY: {
-                void *handle;
-                struct inode *inode = obd->u.obt.obt_sb->s_root->d_inode;
-                BDEVNAME_DECLARE_STORAGE(tmp);
-                CERROR("*** setting device %s read-only ***\n",
-                       ll_bdevname(obd->u.obt.obt_sb, tmp));
-
-                handle = fsfilt_start(obd, inode, FSFILT_OP_MKNOD, NULL);
-                if (!IS_ERR(handle))
-                        rc = fsfilt_commit(obd, inode, handle, 1);
-
-                CDEBUG(D_HA, "syncing mds %s\n", obd->obd_name);
-                rc = fsfilt_sync(obd, obd->u.obt.obt_sb);
-
-                lvfs_set_rdonly(obd, obd->u.obt.obt_sb);
-                RETURN(0);
-        }
-
-        case OBD_IOC_CATLOGLIST: {
-                int count = mds->mds_lov_desc.ld_tgt_count;
-                rc = llog_catalog_list(obd, count, data);
-                RETURN(rc);
-
-        }
-        case OBD_IOC_LLOG_CHECK:
-        case OBD_IOC_LLOG_CANCEL:
-        case OBD_IOC_LLOG_REMOVE: {
-                struct llog_ctxt *ctxt =
-                        llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
-                int rc2;
-                __u32 group;
-
-                obd_llog_finish(obd, mds->mds_lov_desc.ld_tgt_count);
-                push_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_lvfs_ctxt, NULL);
-                rc = llog_ioctl(ctxt, cmd, data);
-                pop_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_lvfs_ctxt, NULL);
-                llog_cat_initialize(obd, &obd->obd_olg,
-                                    mds->mds_lov_desc.ld_tgt_count, NULL);
-                group = FILTER_GROUP_MDS0 + mds->mds_id;
-                llog_ctxt_put(ctxt);
-                rc2 = obd_set_info_async(mds->mds_osc_exp,
-                                         strlen(KEY_MDS_CONN), KEY_MDS_CONN,
-                                         sizeof(group), &group, NULL);
-                if (!rc)
-                        rc = rc2;
-                RETURN(rc);
-        }
-        case OBD_IOC_LLOG_INFO:
-        case OBD_IOC_LLOG_PRINT: {
-                struct llog_ctxt *ctxt =
-                        llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
-
-                push_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_lvfs_ctxt, NULL);
-                rc = llog_ioctl(ctxt, cmd, data);
-                pop_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_lvfs_ctxt, NULL);
-                llog_ctxt_put(ctxt);
-
-                RETURN(rc);
-        }
-
-        case OBD_IOC_ABORT_RECOVERY:
-                CERROR("aborting recovery for device %s\n", obd->obd_name);
-                target_stop_recovery_thread(obd);
-                RETURN(0);
-
-        default:
-                CDEBUG(D_INFO, "unknown command %x\n", cmd);
-                RETURN(-EINVAL);
-        }
-        RETURN(0);
-
-}
-
 /* Collect the preconditions we need to allow client connects */
 static void mds_allow_cli(struct obd_device *obd, unsigned int flag)
 {
@@ -1091,57 +850,3 @@ int mds_notify(struct obd_device *obd, struct obd_device *watched,
         RETURN(rc);
 }
 
-/* Convert the on-disk LOV EA structre.
- * We always try to convert from an old LOV EA format to the common in-memory
- * (lsm) format (obd_unpackmd() understands the old on-disk (lmm) format) and
- * then convert back to the new on-disk format and save it back to disk
- * (obd_packmd() only ever saves to the new on-disk format) so we don't have
- * to convert it each time this inode is accessed.
- *
- * This function is a bit interesting in the error handling.  We can safely
- * ship the old lmm to the client in case of failure, since it uses the same
- * obd_unpackmd() code and can do the conversion if the MDS fails for some
- * reason.  We will not delete the old lmm data until we have written the
- * new format lmm data in fsfilt_set_md(). */
-int mds_convert_lov_ea(struct obd_device *obd, struct inode *inode,
-                       struct lov_mds_md *lmm, int lmm_size)
-{
-        struct lov_stripe_md *lsm = NULL;
-        void *handle;
-        int rc, err;
-        ENTRY;
-
-        if (le32_to_cpu(lmm->lmm_magic) == LOV_MAGIC ||
-            le32_to_cpu(lmm->lmm_magic == LOV_MAGIC_JOIN))
-                RETURN(0);
-
-        CDEBUG(D_INODE, "converting LOV EA on %lu/%u from %#08x to %#08x\n",
-               inode->i_ino, inode->i_generation, le32_to_cpu(lmm->lmm_magic),
-               LOV_MAGIC);
-
-        rc = obd_unpackmd(obd->u.mds.mds_osc_exp, &lsm, lmm, lmm_size);
-        if (rc < 0)
-                GOTO(conv_end, rc);
-
-        rc = obd_packmd(obd->u.mds.mds_osc_exp, &lmm, lsm);
-        if (rc < 0)
-                GOTO(conv_free, rc);
-        lmm_size = rc;
-
-        handle = fsfilt_start(obd, inode, FSFILT_OP_SETATTR, NULL);
-        if (IS_ERR(handle)) {
-                rc = PTR_ERR(handle);
-                GOTO(conv_free, rc);
-        }
-
-        rc = fsfilt_set_md(obd, inode, handle, lmm, lmm_size, "lov");
-
-        err = fsfilt_commit(obd, inode, handle, 0);
-        if (!rc)
-                rc = err ? err : lmm_size;
-        GOTO(conv_free, rc);
-conv_free:
-        obd_free_memmd(obd->u.mds.mds_osc_exp, &lsm);
-conv_end:
-        return rc;
-}