Whamcloud - gitweb
LU-5814 lov: remove LL_IOC_RECREATE_{FID,OBJ} 42/12442/4
authorJohn L. Hammond <john.hammond@intel.com>
Mon, 27 Oct 2014 21:13:21 +0000 (16:13 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 4 Nov 2014 18:12:42 +0000 (18:12 +0000)
Remove the obsolete ioctls LL_IOC_RECREATE_FID and LL_IOC_RECREATE_OBJ
along with their handlers in llite. Remove the then unused OBD method
lov_create(). Remove OBD_FL_RECREATE_OBJS handling from osc_create().

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: Ib7183235d9eb761d2dfa2072dbeb8dd4d918e4ad
Reviewed-on: http://review.whamcloud.com/12442
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Bobi Jam <bobijam@gmail.com>
lustre/include/lustre/lustre_user.h
lustre/llite/file.c
lustre/lov/lov_obd.c
lustre/osc/osc_request.c

index 6beed4e..68d186c 100644 (file)
@@ -218,8 +218,8 @@ struct ost_id {
 #define LL_IOC_LOV_SETSTRIPE            _IOW ('f', 154, long)
 #define LL_IOC_LOV_GETSTRIPE            _IOW ('f', 155, long)
 #define LL_IOC_LOV_SETEA                _IOW ('f', 156, long)
-#define LL_IOC_RECREATE_OBJ             _IOW ('f', 157, long)
-#define LL_IOC_RECREATE_FID             _IOW ('f', 157, struct lu_fid)
+/*     LL_IOC_RECREATE_OBJ             157 obsolete */
+/*     LL_IOC_RECREATE_FID             157 obsolete */
 #define LL_IOC_GROUP_LOCK               _IOW ('f', 158, long)
 #define LL_IOC_GROUP_UNLOCK             _IOW ('f', 159, long)
 /*     LL_IOC_QUOTACHECK               160 OBD_IOC_QUOTACHECK */
index 6bd91ed..5d64995 100644 (file)
@@ -1431,88 +1431,6 @@ static ssize_t ll_file_splice_read(struct file *in_file, loff_t *ppos,
         RETURN(result);
 }
 
-static int ll_lov_recreate(struct inode *inode, struct ost_id *oi,
-                           obd_count ost_idx)
-{
-       struct obd_export *exp = ll_i2dtexp(inode);
-       struct obd_trans_info oti = { 0 };
-       struct obdo *oa = NULL;
-       int lsm_size;
-       int rc = 0;
-       struct lov_stripe_md *lsm = NULL, *lsm2;
-       ENTRY;
-
-       OBDO_ALLOC(oa);
-       if (oa == NULL)
-               RETURN(-ENOMEM);
-
-       lsm = ccc_inode_lsm_get(inode);
-       if (!lsm_has_objects(lsm))
-                GOTO(out, rc = -ENOENT);
-
-        lsm_size = sizeof(*lsm) + (sizeof(struct lov_oinfo) *
-                   (lsm->lsm_stripe_count));
-
-        OBD_ALLOC_LARGE(lsm2, lsm_size);
-        if (lsm2 == NULL)
-                GOTO(out, rc = -ENOMEM);
-
-       oa->o_oi = *oi;
-        oa->o_nlink = ost_idx;
-        oa->o_flags |= OBD_FL_RECREATE_OBJS;
-        oa->o_valid = OBD_MD_FLID | OBD_MD_FLFLAGS | OBD_MD_FLGROUP;
-        obdo_from_inode(oa, inode, OBD_MD_FLTYPE | OBD_MD_FLATIME |
-                                   OBD_MD_FLMTIME | OBD_MD_FLCTIME);
-        obdo_set_parent_fid(oa, &ll_i2info(inode)->lli_fid);
-        memcpy(lsm2, lsm, lsm_size);
-       ll_inode_size_lock(inode);
-       rc = obd_create(NULL, exp, oa, &lsm2, &oti);
-       ll_inode_size_unlock(inode);
-
-       OBD_FREE_LARGE(lsm2, lsm_size);
-       GOTO(out, rc);
-out:
-       ccc_inode_lsm_put(inode, lsm);
-       OBDO_FREE(oa);
-       return rc;
-}
-
-static int ll_lov_recreate_obj(struct inode *inode, unsigned long arg)
-{
-       struct ll_recreate_obj ucreat;
-       struct ost_id           oi;
-       ENTRY;
-
-       if (!cfs_capable(CFS_CAP_SYS_ADMIN))
-               RETURN(-EPERM);
-
-       if (copy_from_user(&ucreat, (struct ll_recreate_obj __user *)arg,
-                          sizeof(ucreat)))
-               RETURN(-EFAULT);
-
-       ostid_set_seq_mdt0(&oi);
-       ostid_set_id(&oi, ucreat.lrc_id);
-       RETURN(ll_lov_recreate(inode, &oi, ucreat.lrc_ost_idx));
-}
-
-static int ll_lov_recreate_fid(struct inode *inode, unsigned long arg)
-{
-       struct lu_fid   fid;
-       struct ost_id   oi;
-       obd_count       ost_idx;
-        ENTRY;
-
-       if (!cfs_capable(CFS_CAP_SYS_ADMIN))
-               RETURN(-EPERM);
-
-       if (copy_from_user(&fid, (struct lu_fid __user *)arg, sizeof(fid)))
-               RETURN(-EFAULT);
-
-       fid_to_ostid(&fid, &oi);
-       ost_idx = (fid_seq(&fid) >> 16) & 0xffff;
-       RETURN(ll_lov_recreate(inode, &oi, ost_idx));
-}
-
 int ll_lov_setstripe_ea_info(struct inode *inode, struct file *file,
                              __u64  flags, struct lov_user_md *lum,
                             int lum_size)
@@ -2405,10 +2323,6 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
        }
         case LL_IOC_LOV_GETSTRIPE:
                 RETURN(ll_lov_getstripe(inode, arg));
-        case LL_IOC_RECREATE_OBJ:
-                RETURN(ll_lov_recreate_obj(inode, arg));
-        case LL_IOC_RECREATE_FID:
-                RETURN(ll_lov_recreate_fid(inode, arg));
         case FSFILT_IOC_FIEMAP:
                 RETURN(ll_ioctl_fiemap(inode, arg));
         case FSFILT_IOC_GETFLAGS:
index fa0b70b..b5df73c 100644 (file)
@@ -1017,87 +1017,6 @@ out:
         RETURN(rc);
 }
 
-static int lov_recreate(struct obd_export *exp, struct obdo *src_oa,
-                        struct lov_stripe_md **ea, struct obd_trans_info *oti)
-{
-        struct lov_stripe_md *obj_mdp, *lsm;
-        struct lov_obd *lov = &exp->exp_obd->u.lov;
-        unsigned ost_idx;
-        int rc, i;
-        ENTRY;
-
-        LASSERT(src_oa->o_valid & OBD_MD_FLFLAGS &&
-                src_oa->o_flags & OBD_FL_RECREATE_OBJS);
-
-        OBD_ALLOC(obj_mdp, sizeof(*obj_mdp));
-        if (obj_mdp == NULL)
-                RETURN(-ENOMEM);
-
-        ost_idx = src_oa->o_nlink;
-        lsm = *ea;
-        if (lsm == NULL)
-                GOTO(out, rc = -EINVAL);
-        if (ost_idx >= lov->desc.ld_tgt_count ||
-            !lov->lov_tgts[ost_idx])
-                GOTO(out, rc = -EINVAL);
-
-       for (i = 0; i < lsm->lsm_stripe_count; i++) {
-               struct lov_oinfo *loi = lsm->lsm_oinfo[i];
-
-               if (lov_oinfo_is_dummy(loi))
-                       continue;
-
-               if (loi->loi_ost_idx == ost_idx) {
-                       if (ostid_id(&loi->loi_oi) !=
-                                       ostid_id(&src_oa->o_oi))
-                               GOTO(out, rc = -EINVAL);
-                       break;
-               }
-       }
-        if (i == lsm->lsm_stripe_count)
-                GOTO(out, rc = -EINVAL);
-
-        rc = obd_create(NULL, lov->lov_tgts[ost_idx]->ltd_exp,
-                        src_oa, &obj_mdp, oti);
-out:
-        OBD_FREE(obj_mdp, sizeof(*obj_mdp));
-        RETURN(rc);
-}
-
-/* the LOV expects oa->o_id to be set to the LOV object id */
-static int lov_create(const struct lu_env *env, struct obd_export *exp,
-                      struct obdo *src_oa, struct lov_stripe_md **ea,
-                      struct obd_trans_info *oti)
-{
-        struct lov_obd *lov;
-        int rc = 0;
-        ENTRY;
-
-        LASSERT(ea != NULL);
-        if (exp == NULL)
-                RETURN(-EINVAL);
-
-        if ((src_oa->o_valid & OBD_MD_FLFLAGS) &&
-            src_oa->o_flags == OBD_FL_DELORPHAN) {
-               /* should be used with LOV anymore */
-               LBUG();
-        }
-
-        lov = &exp->exp_obd->u.lov;
-        if (!lov->desc.ld_active_tgt_count)
-                RETURN(-EIO);
-
-        obd_getref(exp->exp_obd);
-        /* Recreate a specific object id at the given OST index */
-        if ((src_oa->o_valid & OBD_MD_FLFLAGS) &&
-            (src_oa->o_flags & OBD_FL_RECREATE_OBJS)) {
-                 rc = lov_recreate(exp, src_oa, ea, oti);
-        }
-
-        obd_putref(exp->exp_obd);
-        RETURN(rc);
-}
-
 #define ASSERT_LSM_MAGIC(lsmp)                                                  \
 do {                                                                            \
         LASSERT((lsmp) != NULL);                                                \
@@ -2399,7 +2318,6 @@ static struct obd_ops lov_obd_ops = {
        .o_statfs_async         = lov_statfs_async,
        .o_packmd               = lov_packmd,
        .o_unpackmd             = lov_unpackmd,
-       .o_create               = lov_create,
        .o_destroy              = lov_destroy,
        .o_getattr_async        = lov_getattr_async,
        .o_setattr_async        = lov_setattr_async,
index a1e70f0..c708dfe 100644 (file)
@@ -701,11 +701,6 @@ int osc_create(const struct lu_env *env, struct obd_export *exp,
        LASSERT(ea);
        LASSERT(oa->o_valid & OBD_MD_FLGROUP);
 
-       if ((oa->o_valid & OBD_MD_FLFLAGS) &&
-           oa->o_flags == OBD_FL_RECREATE_OBJS) {
-               RETURN(osc_real_create(exp, oa, ea, oti));
-       }
-
        if (!fid_seq_is_mdt(ostid_seq(&oa->o_oi)))
                RETURN(osc_real_create(exp, oa, ea, oti));