+ case LL_IOC_MIGRATE: {
+ char *buf = NULL;
+ const char *filename;
+ int namelen = 0;
+ int len;
+ int rc;
+ int mdtidx;
+
+ rc = obd_ioctl_getdata(&buf, &len, (void __user *)arg);
+ if (rc < 0)
+ RETURN(rc);
+
+ data = (struct obd_ioctl_data *)buf;
+ if (data->ioc_inlbuf1 == NULL || data->ioc_inlbuf2 == NULL ||
+ data->ioc_inllen1 == 0 || data->ioc_inllen2 == 0)
+ GOTO(migrate_free, rc = -EINVAL);
+
+ filename = data->ioc_inlbuf1;
+ namelen = data->ioc_inllen1;
+ /* \0 is packed at the end of filename */
+ if (namelen < 1 || namelen != strlen(filename) + 1)
+ GOTO(migrate_free, rc = -EINVAL);
+
+ if (data->ioc_inllen2 != sizeof(mdtidx))
+ GOTO(migrate_free, rc = -EINVAL);
+ mdtidx = *(int *)data->ioc_inlbuf2;
+
+ rc = ll_migrate(inode, file, mdtidx, filename, namelen - 1);
+migrate_free:
+ obd_ioctl_freedata(buf, len);
+
+ RETURN(rc);
+ }