Beispiel #1
0
static int mds_quota_setup(struct obd_device *obd)
{
        struct obd_device_target *obt = &obd->u.obt;
        struct mds_obd *mds = &obd->u.mds;
        int rc;
        ENTRY;

        if (unlikely(mds->mds_quota)) {
                CWARN("try to reinitialize quota context!\n");
                RETURN(0);
        }

        cfs_init_rwsem(&obt->obt_rwsem);
        obt->obt_qfmt = LUSTRE_QUOTA_V2;
        mds->mds_quota_info.qi_version = LUSTRE_QUOTA_V2;
        cfs_sema_init(&obt->obt_quotachecking, 1);
        /* initialize quota master and quota context */
        cfs_init_rwsem(&mds->mds_qonoff_sem);
        rc = qctxt_init(obd, dqacq_handler);
        if (rc) {
                CERROR("%s: initialize quota context failed! (rc:%d)\n",
                       obd->obd_name, rc);
                RETURN(rc);
        }
        mds->mds_quota = 1;
        RETURN(rc);
}
Beispiel #2
0
static int filter_quota_setup(struct obd_device *obd)
{
        int rc = 0;
        struct obd_device_target *obt = &obd->u.obt;
        ENTRY;

        cfs_init_rwsem(&obt->obt_rwsem);
        obt->obt_qfmt = LUSTRE_QUOTA_V2;
        cfs_sema_init(&obt->obt_quotachecking, 1);
        rc = qctxt_init(obd, NULL);
        if (rc)
                CERROR("initialize quota context failed! (rc:%d)\n", rc);

        RETURN(rc);
}
Beispiel #3
0
/*
 * directory structure on legacy OST:
 *
 * O/<seq>/d0-31/<objid>
 * O/<seq>/LAST_ID
 * last_rcvd
 * LAST_GROUP
 * CONFIGS
 *
 */
int osd_compat_init(struct osd_device *dev)
{
        struct lvfs_run_ctxt  new;
        struct lvfs_run_ctxt  save;
        struct dentry        *rootd = osd_sb(dev)->s_root;
        struct dentry        *d;
        int                   rc;
        int                   i;

        ENTRY;

        /* to get subdir count from last_rcvd */
        rc = osd_last_rcvd_subdir_count(dev);
        if (rc <= 0)
                RETURN(rc);

        dev->od_ost_map->subdir_count = rc;
        rc = 0;

        OBD_ALLOC_PTR(dev->od_ost_map);
        if (dev->od_ost_map == NULL)
                RETURN(-ENOMEM);

        LASSERT(dev->od_fsops);
        osd_push_ctxt(dev, &new, &save);

        d = simple_mkdir(rootd, dev->od_mnt, "O", 0755, 1);
        pop_ctxt(&save, &new, NULL);
        if (IS_ERR(d)) {
                OBD_FREE_PTR(dev->od_ost_map);
                RETURN(PTR_ERR(d));
        }

        dev->od_ost_map->root = d;

        /* Initialize all groups */
        for (i = 0; i < MAX_OBJID_GROUP; i++) {
                cfs_sema_init(&dev->od_ost_map->groups[i].dir_init_sem, 1);
                rc = osd_compat_seq_init(dev, i);
                if (rc) {
                        osd_compat_fini(dev);
                        break;
                }
        }

        RETURN(rc);
}