return (osd->od_mnt == NULL || sb->s_flags & SB_RDONLY);
}
+static int osd_get_info(const struct lu_env *env, struct obd_export *exp,
+ __u32 keylen, void *key, __u32 *vallen, void *val)
+{
+ struct osd_device *osd;
+ int rc = -EINVAL;
+
+ ENTRY;
+
+ if (!exp->exp_obd) {
+ CDEBUG(D_IOCTL, "invalid client export %p\n", exp);
+ RETURN(-EINVAL);
+ }
+ osd = osd_dev(exp->exp_obd->obd_lu_dev);
+
+ if (KEY_IS(KEY_FID2IDX)) {
+ struct lu_seq_range range;
+ struct lu_fid fid;
+
+ if (osd_seq_site(osd)->ss_server_fld == NULL)
+ RETURN(-EINPROGRESS);
+
+ LASSERT(*vallen = sizeof(struct lu_fid));
+ memcpy(&fid, val, sizeof(struct lu_fid));
+
+ fld_range_set_any(&range);
+
+ rc = osd_fld_lookup(env, osd, fid_seq(&fid), &range);
+ if (rc == 0) {
+ memcpy(val, &range, sizeof(range));
+ *vallen = sizeof(range);
+ }
+ }
+
+ RETURN(rc);
+}
+
/*
* lprocfs legacy support.
*/
.o_connect = osd_obd_connect,
.o_disconnect = osd_obd_disconnect,
.o_health_check = osd_health_check,
+ .o_get_info = osd_get_info,
};
static ssize_t delayed_unlink_mb_show(struct kobject *kobj,
#ifdef HAVE_FSMAP_H
#include <linux/fsmap.h>
#endif
+#include <linux/uaccess.h>
#include <llog_swab.h>
#include <lustre_disk.h>
struct inode *root_inode;
int err = -ENOTTY;
+ if (cmd == LL_IOC_FID2MDTIDX) {
+ union {
+ struct lu_seq_range range;
+ struct lu_fid fid;
+ } u;
+ struct lu_env *env;
+ int len;
+
+ if (copy_from_user(&u.fid, (struct lu_fid __user *)arg,
+ sizeof(u.fid)))
+ RETURN(-EFAULT);
+
+ OBD_ALLOC_PTR(env);
+ if (env == NULL)
+ return -ENOMEM;
+ err = lu_env_init(env, LCT_DT_THREAD);
+ if (err)
+ GOTO(out, err = -ENOMEM);
+
+ /* XXX: check for size */
+ len = sizeof(struct lu_fid);
+ err = obd_get_info(env, lsi->lsi_osd_exp, sizeof(KEY_FID2IDX),
+ KEY_FID2IDX, &len, &u.fid);
+ if (err == 0) {
+ err = -EINVAL;
+ if (u.range.lsr_flags & LU_SEQ_RANGE_MDT)
+ err = u.range.lsr_index;
+ }
+ lu_env_fini(env);
+out:
+ OBD_FREE_PTR(env);
+ return err;
+ }
+
if (!is_cmd_supported(cmd))
return err;