*/
int (*dt_statfs)(const struct lu_env *env,
struct dt_device *dev,
- struct obd_statfs *osfs);
+ struct obd_statfs *osfs,
+ struct obd_statfs_info *info);
/**
* Create transaction.
struct dt_device_param *param);
/**
+ * Return device's super block.
+ *
+ * \param[in] dev dt device
+ */
+ struct super_block *(*dt_mnt_sb_get)(const struct dt_device *dev);
+
+ /**
* Sync the device.
*
* Sync all the cached state (dirty buffers, pages, etc) to the
};
enum dt_index_flags {
- /** index supports variable sized keys */
- DT_IND_VARKEY = 1 << 0,
- /** index supports variable sized records */
- DT_IND_VARREC = 1 << 1,
- /** index can be modified */
- DT_IND_UPDATE = 1 << 2,
- /** index supports records with non-unique (duplicate) keys */
- DT_IND_NONUNQ = 1 << 3,
- /**
- * index support fixed-size keys sorted with natural numerical way
- * and is able to return left-side value if no exact value found
- */
- DT_IND_RANGE = 1 << 4,
+ /** index supports variable sized keys */
+ DT_IND_VARKEY = BIT(0),
+ /** index supports variable sized records */
+ DT_IND_VARREC = BIT(1),
+ /** index can be modified */
+ DT_IND_UPDATE = BIT(2),
+ /** index supports records with non-unique (duplicate) keys */
+ DT_IND_NONUNQ = BIT(3),
+ /**
+ * index support fixed-size keys sorted with natural numerical way
+ * and is able to return left-side value if no exact value found
+ */
+ DT_IND_RANGE = BIT(4),
+};
+
+/* for dt_read_lock() and dt_write_lock() object lock rule */
+enum dt_object_role {
+ DT_SRC_PARENT,
+ DT_SRC_CHILD,
+ DT_TGT_PARENT,
+ DT_TGT_CHILD,
+ DT_TGT_ORPHAN,
+ DT_LASTID,
};
/**
const void *dah_eadata;
int dah_eadata_len;
__u32 dah_mode;
+ int dah_append_stripes;
+ char *dah_append_pool;
};
/**
* \param[in] pos position in the object to start
* \param[out] pos \a pos + bytes written
* \param[in] th transaction handle
- * \param[in] ignore unused (was used to request quota ignorance)
*
* \retval positive bytes written on success
* \retval negative negated errno on error
struct dt_object *dt,
const struct lu_buf *buf,
loff_t *pos,
- struct thandle *th,
- int ignore);
+ struct thandle *th);
/**
* Return buffers for data.
* \param[in] pos position in the object to start
* \param[in] len size of region in bytes
* \param[out] lb array of descriptors to fill
+ * \param[in] maxlnb max slots in @lnb array
* \param[in] rw 0 if used to read, 1 if used for write
*
* \retval positive number of descriptors on success
loff_t pos,
ssize_t len,
struct niobuf_local *lb,
+ int maxlnb,
enum dt_bufs_type rw);
/**
__u64 start,
__u64 end,
enum lu_ladvise_type advice);
+
+ /**
+ * Declare intention to preallocate space for an object
+ *
+ * \param[in] env execution environment for this thread
+ * \param[in] dt object
+ * \param[in] th transaction handle
+ *
+ * \retval 0 on success
+ * \retval negative negated errno on error
+ */
+ int (*dbo_declare_fallocate)(const struct lu_env *env,
+ struct dt_object *dt,
+ struct thandle *th);
+ /**
+ * Allocate specified region for an object
+ *
+ * \param[in] env execution environment for this thread
+ * \param[in] dt object
+ * \param[in] start the start of the region to allocate
+ * \param[in] end the end of the region to allocate
+ * \param[in] mode fallocate mode
+ * \param[in] th transaction handle
+ *
+ * \retval 0 on success
+ * \retval negative negated errno on error
+ */
+ int (*dbo_fallocate)(const struct lu_env *env,
+ struct dt_object *dt,
+ __u64 start,
+ __u64 end,
+ int mode,
+ struct thandle *th);
};
/**
* \param[in] rec buffer storing value
* \param[in] key key
* \param[in] th transaction handle
- * \param[in] ignore unused (was used to request quota ignorance)
*
* \retval 0 on success
* \retval negative negated errno on error
struct dt_object *dt,
const struct dt_rec *rec,
const struct dt_key *key,
- struct thandle *th,
- int ignore);
+ struct thandle *th);
/**
* Declare intention to delete a key/value from an index.
struct list_head dd_txn_callbacks;
unsigned int dd_record_fid_accessed:1,
dd_rdonly:1;
+
+ /* sysfs and debugfs handling */
+ struct dentry *dd_debugfs_entry;
+
+ const struct attribute **dd_def_attrs;
+ struct kobject dd_kobj;
+ struct kobj_type dd_ktype;
+ struct completion dd_kobj_unregister;
};
int dt_device_init(struct dt_device *dev, struct lu_device_type *t);
struct thandle *txn, void *cookie);
int (*dtc_txn_stop)(const struct lu_env *env,
struct thandle *txn, void *cookie);
- void (*dtc_txn_commit)(struct thandle *txn, void *cookie);
void *dtc_cookie;
__u32 dtc_tag;
struct list_head dtc_linkage;
int dt_txn_hook_start(const struct lu_env *env,
struct dt_device *dev, struct thandle *txn);
int dt_txn_hook_stop(const struct lu_env *env, struct thandle *txn);
-void dt_txn_hook_commit(struct thandle *txn);
int dt_try_as_dir(const struct lu_env *env, struct dt_object *obj);
return o->do_ops->do_object_sync(env, o, start, end);
}
+static inline int dt_fid_alloc(const struct lu_env *env,
+ struct dt_device *d,
+ struct lu_fid *fid,
+ struct lu_object *parent,
+ const struct lu_name *name)
+{
+ struct lu_device *l = dt2lu_dev(d);
+
+ return l->ld_ops->ldo_fid_alloc(env, l, fid, parent, name);
+}
+
int dt_declare_version_set(const struct lu_env *env, struct dt_object *o,
struct thandle *th);
void dt_version_set(const struct lu_env *env, struct dt_object *o,
static inline int dt_bufs_get(const struct lu_env *env, struct dt_object *d,
struct niobuf_remote *rnb,
- struct niobuf_local *lnb, enum dt_bufs_type rw)
+ struct niobuf_local *lnb, int maxlnb,
+ enum dt_bufs_type rw)
{
LASSERT(d);
LASSERT(d->do_body_ops);
LASSERT(d->do_body_ops->dbo_bufs_get);
return d->do_body_ops->dbo_bufs_get(env, d, rnb->rnb_offset,
- rnb->rnb_len, lnb, rw);
+ rnb->rnb_len, lnb, maxlnb, rw);
}
static inline int dt_bufs_put(const struct lu_env *env, struct dt_object *d,
static inline ssize_t dt_write(const struct lu_env *env, struct dt_object *dt,
const struct lu_buf *buf, loff_t *pos,
- struct thandle *th, int rq)
+ struct thandle *th)
{
LASSERT(dt);
LASSERT(dt->do_body_ops);
LASSERT(dt->do_body_ops->dbo_write);
- return dt->do_body_ops->dbo_write(env, dt, buf, pos, th, rq);
+ return dt->do_body_ops->dbo_write(env, dt, buf, pos, th);
}
static inline int dt_declare_punch(const struct lu_env *env,
return dt->do_body_ops->dbo_ladvise(env, dt, start, end, advice);
}
+static inline int dt_declare_falloc(const struct lu_env *env,
+ struct dt_object *dt, struct thandle *th)
+{
+ LASSERT(dt);
+ if (!dt->do_body_ops)
+ return -EOPNOTSUPP;
+ LASSERT(dt->do_body_ops);
+ LASSERT(dt->do_body_ops->dbo_declare_fallocate);
+ return dt->do_body_ops->dbo_declare_fallocate(env, dt, th);
+}
+
+static inline int dt_falloc(const struct lu_env *env, struct dt_object *dt,
+ __u64 start, __u64 end, int mode,
+ struct thandle *th)
+{
+ LASSERT(dt);
+ if (!dt->do_body_ops)
+ return -EOPNOTSUPP;
+ LASSERT(dt->do_body_ops);
+ LASSERT(dt->do_body_ops->dbo_fallocate);
+ return dt->do_body_ops->dbo_fallocate(env, dt, start, end, mode, th);
+}
+
static inline int dt_fiemap_get(const struct lu_env *env, struct dt_object *d,
struct fiemap *fm)
{
return d->do_body_ops->dbo_fiemap_get(env, d, fm);
}
+static inline int dt_statfs_info(const struct lu_env *env,
+ struct dt_device *dev,
+ struct obd_statfs *osfs,
+ struct obd_statfs_info *info)
+{
+ LASSERT(dev);
+ LASSERT(dev->dd_ops);
+ LASSERT(dev->dd_ops->dt_statfs);
+ return dev->dd_ops->dt_statfs(env, dev, osfs, info);
+}
+
static inline int dt_statfs(const struct lu_env *env, struct dt_device *dev,
- struct obd_statfs *osfs)
+ struct obd_statfs *osfs)
{
- LASSERT(dev);
- LASSERT(dev->dd_ops);
- LASSERT(dev->dd_ops->dt_statfs);
- return dev->dd_ops->dt_statfs(env, dev, osfs);
+ return dt_statfs_info(env, dev, osfs, NULL);
}
static inline int dt_root_get(const struct lu_env *env, struct dt_device *dev,
return dev->dd_ops->dt_conf_get(env, dev, param);
}
+static inline struct super_block *dt_mnt_sb_get(const struct dt_device *dev)
+{
+ LASSERT(dev);
+ LASSERT(dev->dd_ops);
+ if (dev->dd_ops->dt_mnt_sb_get)
+ return dev->dd_ops->dt_mnt_sb_get(dev);
+
+ return ERR_PTR(-EOPNOTSUPP);
+}
+
static inline int dt_sync(const struct lu_env *env, struct dt_device *dev)
{
LASSERT(dev);
}
static inline int dt_insert(const struct lu_env *env,
- struct dt_object *dt,
- const struct dt_rec *rec,
- const struct dt_key *key,
- struct thandle *th,
- int noquota)
+ struct dt_object *dt,
+ const struct dt_rec *rec,
+ const struct dt_key *key,
+ struct thandle *th)
{
LASSERT(dt);
LASSERT(dt->do_index_ops);
if (CFS_FAULT_CHECK(OBD_FAIL_DT_INSERT))
return cfs_fail_err;
- return dt->do_index_ops->dio_insert(env, dt, rec, key, th, noquota);
+ return dt->do_index_ops->dio_insert(env, dt, rec, key, th);
}
static inline int dt_declare_xattr_del(const struct lu_env *env,
int dt_global_init(void);
void dt_global_fini(void);
+int dt_tunables_init(struct dt_device *dt, struct obd_type *type,
+ const char *name, struct lprocfs_vars *list);
+int dt_tunables_fini(struct dt_device *dt);
# ifdef CONFIG_PROC_FS
int lprocfs_dt_blksize_seq_show(struct seq_file *m, void *v);