struct ldlm_enqueue_info;
typedef enum {
- MNTOPT_USERXATTR = 0x00000001,
- MNTOPT_ACL = 0x00000002,
+ MNTOPT_USERXATTR = 0x00000001,
+ MNTOPT_ACL = 0x00000002,
} mntopt_t;
struct dt_device_param {
- unsigned ddp_max_name_len;
- unsigned ddp_max_nlink;
- unsigned ddp_symlink_max;
- mntopt_t ddp_mntopts;
- unsigned ddp_max_ea_size;
- unsigned ddp_mount_type;
+ unsigned int ddp_max_name_len;
+ unsigned int ddp_max_nlink;
+ unsigned int ddp_symlink_max;
+ mntopt_t ddp_mntopts;
+ unsigned int ddp_max_ea_size;
+ unsigned int ddp_mount_type;
unsigned long long ddp_maxbytes;
/* per-inode space consumption */
- short ddp_inodespace;
+ short ddp_inodespace;
/* maximum number of blocks in an extent */
- unsigned ddp_max_extent_blks;
- /* per-extent insertion overhead to be used by client for grant
- * calculation */
- unsigned int ddp_extent_tax;
- unsigned int ddp_brw_size; /* optimal RPC size */
+ unsigned int ddp_max_extent_blks;
+ /* per-extent insertion overhead used by client for grant calculation */
+ unsigned int ddp_extent_tax;
+ unsigned int ddp_brw_size; /* optimal RPC size */
/* T10PI checksum type, zero if not supported */
- enum cksum_types ddp_t10_cksum_type;
- bool ddp_has_lseek_data_hole;
+ enum cksum_types ddp_t10_cksum_type;
+ bool ddp_has_lseek_data_hole;
};
/**
*/
struct dt_txn_commit_cb;
typedef void (*dt_cb_t)(struct lu_env *env, struct thandle *th,
- struct dt_txn_commit_cb *cb, int err);
+ struct dt_txn_commit_cb *cb, int err);
/**
* Special per-transaction callback for cases when just commit callback
* is needed and per-device callback are not convenient to use
};
struct dt_index_features {
- /** required feature flags from enum dt_index_flags */
- __u32 dif_flags;
- /** minimal required key size */
- size_t dif_keysize_min;
- /** maximal required key size, 0 if no limit */
- size_t dif_keysize_max;
- /** minimal required record size */
- size_t dif_recsize_min;
- /** maximal required record size, 0 if no limit */
- size_t dif_recsize_max;
- /** pointer size for record */
- size_t dif_ptrsize;
+ /** required feature flags from enum dt_index_flags */
+ __u32 dif_flags;
+ /** minimal required key size */
+ size_t dif_keysize_min;
+ /** maximal required key size, 0 if no limit */
+ size_t dif_keysize_max;
+ /** minimal required record size */
+ size_t dif_recsize_min;
+ /** maximal required record size, 0 if no limit */
+ size_t dif_recsize_max;
+ /** pointer size for record */
+ size_t dif_ptrsize;
};
enum dt_index_flags {
*/
enum dt_format_type {
- DFT_REGULAR,
- DFT_DIR,
- /** for mknod */
- DFT_NODE,
- /** for special index */
- DFT_INDEX,
- /** for symbolic link */
- DFT_SYM,
+ DFT_REGULAR,
+ DFT_DIR,
+ /** for mknod */
+ DFT_NODE,
+ /** for special index */
+ DFT_INDEX,
+ /** for symbolic link */
+ DFT_SYM,
};
/**
* object format specifier.
*/
struct dt_object_format {
- /** type for dt object */
- enum dt_format_type dof_type;
- union {
- struct dof_regular {
+ /** type for dt object */
+ enum dt_format_type dof_type;
+ union {
+ struct dof_regular {
int striped;
- } dof_reg;
- struct dof_dir {
- } dof_dir;
- struct dof_node {
- } dof_node;
- /**
- * special index need feature as parameter to create
- * special idx
- */
- struct dof_index {
- const struct dt_index_features *di_feat;
- } dof_idx;
- } u;
+ } dof_reg;
+ struct dof_dir {
+ } dof_dir;
+ struct dof_node {
+ } dof_node;
+ /**
+ * special index need feature as parameter to create
+ * special idx
+ */
+ struct dof_index {
+ const struct dt_index_features *di_feat;
+ } dof_idx;
+ } u;
};
enum dt_format_type dt_mode_to_dft(__u32 mode);
*/
void (*do_read_lock)(const struct lu_env *env,
struct dt_object *dt,
- unsigned role);
+ unsigned int role);
/*
* Get write lock on object.
*/
void (*do_write_lock)(const struct lu_env *env,
struct dt_object *dt,
- unsigned role);
+ unsigned int role);
/**
* Release read lock.
* \param[in] env execution environment for this thread
* \param[in] dt object
*/
- void (*do_read_unlock)(const struct lu_env *env,
- struct dt_object *dt);
+ void (*do_read_unlock)(const struct lu_env *env,
+ struct dt_object *dt);
/**
* Release write lock.
* \param[in] env execution environment for this thread
* \param[in] dt object
*/
- void (*do_write_unlock)(const struct lu_env *env,
- struct dt_object *dt);
+ void (*do_write_unlock)(const struct lu_env *env,
+ struct dt_object *dt);
/**
* Check whether write lock is held.
* \retval 0 no write lock
* \retval 1 write lock is held
*/
- int (*do_write_locked)(const struct lu_env *env,
- struct dt_object *dt);
+ int (*do_write_locked)(const struct lu_env *env,
+ struct dt_object *dt);
/**
* Declare intention to request reqular attributes.
*
* \retval 0 on success
* \retval negative negated errno on error
- */
- int (*do_declare_attr_set)(const struct lu_env *env,
- struct dt_object *dt,
- const struct lu_attr *attr,
+ */
+ int (*do_declare_attr_set)(const struct lu_env *env,
+ struct dt_object *dt,
+ const struct lu_attr *attr,
struct thandle *th);
/**
* \retval 0 on success
* \retval negative negated errno on error
*/
- int (*do_attr_set)(const struct lu_env *env,
- struct dt_object *dt,
- const struct lu_attr *attr,
+ int (*do_attr_set)(const struct lu_env *env,
+ struct dt_object *dt,
+ const struct lu_attr *attr,
struct thandle *th);
/**
*
* \retval 0 on success
* \retval negative negated errno on error
- */
+ */
int (*do_declare_xattr_set)(const struct lu_env *env,
struct dt_object *dt,
const struct lu_buf *buf,
*
* \retval positive bytes used/required in the buffer
* \retval negative negated errno on error
- */
+ */
int (*do_xattr_list)(const struct lu_env *env,
struct dt_object *dt,
const struct lu_buf *buf);
* \retval 0 on success
* \retval negative negated errno on error
*/
- int (*do_declare_create)(const struct lu_env *env,
- struct dt_object *dt,
- struct lu_attr *attr,
- struct dt_allocation_hint *hint,
- struct dt_object_format *dof,
- struct thandle *th);
+ int (*do_declare_create)(const struct lu_env *env,
+ struct dt_object *dt,
+ struct lu_attr *attr,
+ struct dt_allocation_hint *hint,
+ struct dt_object_format *dof,
+ struct thandle *th);
/**
* Create new object.
*/
int (*do_create)(const struct lu_env *env,
struct dt_object *dt,
- struct lu_attr *attr,
- struct dt_allocation_hint *hint,
- struct dt_object_format *dof,
- struct thandle *th);
+ struct lu_attr *attr,
+ struct dt_allocation_hint *hint,
+ struct dt_object_format *dof,
+ struct thandle *th);
/**
* Declare intention to destroy an object.
* \retval 0 on success
* \retval negative negated errno on error
*/
- int (*do_declare_destroy)(const struct lu_env *env,
- struct dt_object *dt,
- struct thandle *th);
+ int (*do_declare_destroy)(const struct lu_env *env,
+ struct dt_object *dt,
+ struct thandle *th);
/**
* Destroy an object.
/**
* Try object as an index.
*
- * Announce that this object is going to be used as an index. This
+ * Announce that this object is going to be used as an index. This
* operation checks that object supports indexing operations and
- * installs appropriate dt_index_operations vector on success.
- * Also probes for features. Operation is successful if all required
+ * installs appropriate dt_index_operations vector on success.
+ * Also probes for features. Operation is successful if all required
* features are supported. It's not possible to access the object
* with index methods before ->do_index_try() returns success.
*
* \retval 0 on success
* \retval negative negated errno on error
*/
- int (*do_index_try)(const struct lu_env *env,
- struct dt_object *dt,
- const struct dt_index_features *feat);
+ int (*do_index_try)(const struct lu_env *env,
+ struct dt_object *dt,
+ const struct dt_index_features *feat);
/**
* Declare intention to increment nlink count.
* \retval 0 on success
* \retval negative negated errno on error
*/
- int (*do_ref_add)(const struct lu_env *env,
- struct dt_object *dt, struct thandle *th);
+ int (*do_ref_add)(const struct lu_env *env,
+ struct dt_object *dt, struct thandle *th);
/**
* Declare intention to decrement nlink count.
* \retval 0 on success
* \retval negative negated errno on error
*/
- int (*dio_declare_insert)(const struct lu_env *env,
+ int (*dio_declare_insert)(const struct lu_env *env,
struct dt_object *dt,
const struct dt_rec *rec,
const struct dt_key *key,
* \retval 0 on success
* \retval negative negated errno on error
*/
- int (*dio_declare_delete)(const struct lu_env *env,
+ int (*dio_declare_delete)(const struct lu_env *env,
struct dt_object *dt,
const struct dt_key *key,
struct thandle *th);
const struct dt_key *key,
struct thandle *th);
- /**
+ /**
* Iterator interface.
*
* Methods to iterate over an existing index, list the keys stored and
* associated values, get key/value size, etc.
- */
- struct dt_it_ops {
+ */
+ struct dt_it_ops {
/**
* Allocate and initialize new iterator.
*
*
* \retval pointer iterator pointer on success
* \retval ERR_PTR(errno) on error
- */
- struct dt_it *(*init)(const struct lu_env *env,
+ */
+ struct dt_it *(*init)(const struct lu_env *env,
struct dt_object *dt,
__u32 attr);
* \param[in] env execution environment for this thread
* \param[in] di iterator to release
*/
- void (*fini)(const struct lu_env *env,
- struct dt_it *di);
+ void (*fini)(const struct lu_env *env,
+ struct dt_it *di);
/**
* Move position of iterator.
* not larger than the key
* \retval negative negated errno on error
*/
- int (*get)(const struct lu_env *env,
- struct dt_it *di,
- const struct dt_key *key);
+ int (*get)(const struct lu_env *env,
+ struct dt_it *di,
+ const struct dt_key *key);
/**
* Release position
* \param[in] env execution environment for this thread
* \param[in] di iterator
*/
- void (*put)(const struct lu_env *env,
- struct dt_it *di);
+ void (*put)(const struct lu_env *env,
+ struct dt_it *di);
/**
* Move to next record.
* \retval 0 on success, the next record is found
* \retval negative negated errno on error
*/
- int (*next)(const struct lu_env *env,
- struct dt_it *di);
+ int (*next)(const struct lu_env *env,
+ struct dt_it *di);
/**
* Return key.
* \retval pointer to key on success
* \retval ERR_PTR(errno) on error
*/
- struct dt_key *(*key)(const struct lu_env *env,
- const struct dt_it *di);
+ struct dt_key *(*key)(const struct lu_env *env,
+ const struct dt_it *di);
/**
* Return key size.
* \retval key's size on success
* \retval negative negated errno on error
*/
- int (*key_size)(const struct lu_env *env,
- const struct dt_it *di);
+ int (*key_size)(const struct lu_env *env,
+ const struct dt_it *di);
/**
* Return record.
* \retval 0 on success
* \retval negative negated errno on error
*/
- int (*rec)(const struct lu_env *env,
- const struct dt_it *di,
- struct dt_rec *rec,
- __u32 attr);
+ int (*rec)(const struct lu_env *env,
+ const struct dt_it *di,
+ struct dt_rec *rec,
+ __u32 attr);
/**
* Return record size.
*
* \retval cookie/hash of the key
*/
- __u64 (*store)(const struct lu_env *env,
- const struct dt_it *di);
+ __u64 (*store)(const struct lu_env *env,
+ const struct dt_it *di);
/**
* Initialize position using cookie/hash.
* \retval 0 if current position matches cookie
* \retval negative negated errno on error
*/
- int (*load)(const struct lu_env *env,
+ int (*load)(const struct lu_env *env,
const struct dt_it *di,
__u64 hash);
/**
* Not used
*/
- int (*key_rec)(const struct lu_env *env,
+ int (*key_rec)(const struct lu_env *env,
const struct dt_it *di,
void *key_rec);
- } dio_it;
+ } dio_it;
};
enum dt_otable_it_valid {
*
* For otable based iteration, the 32-bits 'attr' for dt_it_ops::init()
* is composed of two parts:
- * low 16-bits is for valid bits, high 16-bits is for flags bits. */
+ * low 16-bits is for valid bits, high 16-bits is for flags bits.
+ */
#define DT_OTABLE_IT_FLAGS_SHIFT 16
-#define DT_OTABLE_IT_FLAGS_MASK 0xffff0000
+#define DT_OTABLE_IT_FLAGS_MASK 0xffff0000
struct dt_device {
- struct lu_device dd_lu_dev;
- const struct dt_device_operations *dd_ops;
-
- /**
- * List of dt_txn_callback (see below). This is not protected in any
- * way, because callbacks are supposed to be added/deleted only during
- * single-threaded start-up shut-down procedures.
- */
+ struct lu_device dd_lu_dev;
+ const struct dt_device_operations *dd_ops;
+
+ /**
+ * List of dt_txn_callback (see below). This is not protected in any
+ * way, because callbacks are supposed to be added/deleted only during
+ * single-threaded start-up shut-down procedures.
+ */
struct list_head dd_txn_callbacks;
unsigned int dd_record_fid_accessed:1,
dd_rdonly:1;
static inline int lu_device_is_dt(const struct lu_device *d)
{
- return ergo(d != NULL, d->ld_type->ldt_tags & LU_DEVICE_DT);
+ return ergo(d != NULL, d->ld_type->ldt_tags & LU_DEVICE_DT);
}
-static inline struct dt_device * lu2dt_dev(struct lu_device *l)
+static inline struct dt_device *lu2dt_dev(struct lu_device *l)
{
LASSERT(lu_device_is_dt(l));
return container_of_safe(l, struct dt_device, dd_lu_dev);
}
struct dt_object {
- struct lu_object do_lu;
- const struct dt_object_operations *do_ops;
- const struct dt_body_operations *do_body_ops;
- const struct dt_index_operations *do_index_ops;
+ struct lu_object do_lu;
+ const struct dt_object_operations *do_ops;
+ const struct dt_body_operations *do_body_ops;
+ const struct dt_index_operations *do_index_ops;
};
/*
static inline struct lu_device *dt2lu_dev(struct dt_device *d)
{
- return &d->dd_lu_dev;
+ return &d->dd_lu_dev;
}
static inline struct dt_object *lu2dt(struct lu_object *l)
}
int dt_object_init(struct dt_object *obj,
- struct lu_object_header *h, struct lu_device *d);
+ struct lu_object_header *h, struct lu_device *d);
void dt_object_fini(struct dt_object *obj);
static inline int dt_object_exists(const struct dt_object *dt)
{
- return lu_object_exists(&dt->do_lu);
+ return lu_object_exists(&dt->do_lu);
}
static inline int dt_object_remote(const struct dt_object *dt)
* device (OSP/OSD == sub thandle layer) needs to get the
* top_thandle (see dt_txn_hook_start/stop()), so we put the
* top thandle here for now, will fix it when we have better
- * callback mechanism */
+ * callback mechanism
+ */
struct thandle *th_top;
/* reserved quota for this handle */
struct lquota_id_info th_reserved_quota;
- /** the last operation result in this transaction.
- * this value is used in recovery */
+ /* last operation result in this transaction. value used in recovery */
__s32 th_result;
/** whether we need sync commit */
unsigned int th_sync:1,
/* local transation, no need to inform other layers */
th_local:1,
- /* Whether we need wait the transaction to be submitted
- * (send to remote target) */
+ /* Do we wait the transaction to be submitted (send to remote target) */
th_wait_submit:1,
- /* complex transaction which will track updates on all targets,
- * including OSTs */
+ /* complex transaction to track updates on all targets including OSTs */
th_complex:1,
/* whether ignore quota */
th_ignore_quota:1,
* before each transaction commit.
*/
struct dt_txn_callback {
- int (*dtc_txn_start)(const struct lu_env *env,
- struct thandle *txn, void *cookie);
- int (*dtc_txn_stop)(const struct lu_env *env,
- struct thandle *txn, void *cookie);
+ int (*dtc_txn_start)(const struct lu_env *env,
+ struct thandle *txn, void *cookie);
+ int (*dtc_txn_stop)(const struct lu_env *env,
+ struct thandle *txn, void *cookie);
void *dtc_cookie;
__u32 dtc_tag;
struct list_head dtc_linkage;
void dt_txn_callback_del(struct dt_device *dev, struct dt_txn_callback *cb);
int dt_txn_hook_start(const struct lu_env *env,
- struct dt_device *dev, struct thandle *txn);
+ struct dt_device *dev, struct thandle *txn);
int dt_txn_hook_stop(const struct lu_env *env, struct thandle *txn);
int dt_try_as_dir(const struct lu_env *env, struct dt_object *obj, bool check);
* \see llo_store_resolve
*/
typedef int (*dt_entry_func_t)(const struct lu_env *env,
- const char *name,
- void *pvt);
+ const char *name,
+ void *pvt);
#define DT_MAX_PATH 1024
int dt_path_parser(const struct lu_env *env,
- char *local, dt_entry_func_t entry_func,
- void *data);
+ char *local, dt_entry_func_t entry_func,
+ void *data);
struct dt_object *
dt_store_resolve(const struct lu_env *env, struct dt_device *dt,
const char *path, struct lu_fid *fid);
struct dt_object *dt_store_open(const struct lu_env *env,
- struct dt_device *dt,
- const char *dirname,
- const char *filename,
- struct lu_fid *fid);
+ struct dt_device *dt,
+ const char *dirname,
+ const char *filename,
+ struct lu_fid *fid);
struct dt_object *dt_find_or_create(const struct lu_env *env,
- struct dt_device *dt,
- const struct lu_fid *fid,
- struct dt_object_format *dof,
- struct lu_attr *attr);
+ struct dt_device *dt,
+ const struct lu_fid *fid,
+ struct dt_object_format *dof,
+ struct lu_attr *attr);
struct dt_object *dt_locate_at(const struct lu_env *env,
struct dt_device *dev,
struct dt_object *o);
int dt_read(const struct lu_env *env, struct dt_object *dt,
- struct lu_buf *buf, loff_t *pos);
+ struct lu_buf *buf, loff_t *pos);
int dt_record_read(const struct lu_env *env, struct dt_object *dt,
- struct lu_buf *buf, loff_t *pos);
+ struct lu_buf *buf, loff_t *pos);
int dt_record_write(const struct lu_env *env, struct dt_object *dt,
- const struct lu_buf *buf, loff_t *pos, struct thandle *th);
+ const struct lu_buf *buf, loff_t *pos, struct thandle *th);
typedef int (*dt_index_page_build_t)(const struct lu_env *env,
struct dt_object *obj, union lu_page *lp,
size_t bytes, const struct dt_it_ops *iops,
const size_t nlupgs);
static inline struct thandle *dt_trans_create(const struct lu_env *env,
- struct dt_device *d)
+ struct dt_device *d)
{
- LASSERT(d->dd_ops->dt_trans_create);
- return d->dd_ops->dt_trans_create(env, d);
+ LASSERT(d->dd_ops->dt_trans_create);
+ return d->dd_ops->dt_trans_create(env, d);
}
static inline int dt_trans_start(const struct lu_env *env,
- struct dt_device *d, struct thandle *th)
+ struct dt_device *d, struct thandle *th)
{
- LASSERT(d->dd_ops->dt_trans_start);
- return d->dd_ops->dt_trans_start(env, d, th);
+ LASSERT(d->dd_ops->dt_trans_start);
+ return d->dd_ops->dt_trans_start(env, d, th);
}
/* for this transaction hooks shouldn't be called */
static inline int dt_trans_start_local(const struct lu_env *env,
- struct dt_device *d, struct thandle *th)
+ struct dt_device *d, struct thandle *th)
{
- LASSERT(d->dd_ops->dt_trans_start);
- th->th_local = 1;
- return d->dd_ops->dt_trans_start(env, d, th);
+ LASSERT(d->dd_ops->dt_trans_start);
+ th->th_local = 1;
+ return d->dd_ops->dt_trans_start(env, d, th);
}
static inline int dt_trans_stop(const struct lu_env *env,
- struct dt_device *d, struct thandle *th)
+ struct dt_device *d, struct thandle *th)
{
LASSERT(d->dd_ops->dt_trans_stop);
return d->dd_ops->dt_trans_stop(env, d, th);
}
static inline int dt_declare_create(const struct lu_env *env,
- struct dt_object *dt,
- struct lu_attr *attr,
- struct dt_allocation_hint *hint,
- struct dt_object_format *dof,
- struct thandle *th)
+ struct dt_object *dt,
+ struct lu_attr *attr,
+ struct dt_allocation_hint *hint,
+ struct dt_object_format *dof,
+ struct thandle *th)
{
- LASSERT(dt);
- LASSERT(dt->do_ops);
- LASSERT(dt->do_ops->do_declare_create);
+ LASSERT(dt);
+ LASSERT(dt->do_ops);
+ LASSERT(dt->do_ops->do_declare_create);
if (CFS_FAULT_CHECK(OBD_FAIL_DT_DECLARE_CREATE))
return cfs_fail_err;
- return dt->do_ops->do_declare_create(env, dt, attr, hint, dof, th);
+ return dt->do_ops->do_declare_create(env, dt, attr, hint, dof, th);
}
static inline int dt_create(const struct lu_env *env,
- struct dt_object *dt,
- struct lu_attr *attr,
- struct dt_allocation_hint *hint,
- struct dt_object_format *dof,
- struct thandle *th)
+ struct dt_object *dt,
+ struct lu_attr *attr,
+ struct dt_allocation_hint *hint,
+ struct dt_object_format *dof,
+ struct thandle *th)
{
- LASSERT(dt);
- LASSERT(dt->do_ops);
- LASSERT(dt->do_ops->do_create);
+ LASSERT(dt);
+ LASSERT(dt->do_ops);
+ LASSERT(dt->do_ops->do_create);
if (CFS_FAULT_CHECK(OBD_FAIL_DT_CREATE))
return cfs_fail_err;
- return dt->do_ops->do_create(env, dt, attr, hint, dof, th);
+ return dt->do_ops->do_create(env, dt, attr, hint, dof, th);
}
static inline int dt_declare_destroy(const struct lu_env *env,
- struct dt_object *dt,
- struct thandle *th)
+ struct dt_object *dt,
+ struct thandle *th)
{
- LASSERT(dt);
- LASSERT(dt->do_ops);
- LASSERT(dt->do_ops->do_declare_destroy);
+ LASSERT(dt);
+ LASSERT(dt->do_ops);
+ LASSERT(dt->do_ops->do_declare_destroy);
if (CFS_FAULT_CHECK(OBD_FAIL_DT_DECLARE_DESTROY))
return cfs_fail_err;
- return dt->do_ops->do_declare_destroy(env, dt, th);
+ return dt->do_ops->do_declare_destroy(env, dt, th);
}
static inline int dt_destroy(const struct lu_env *env,
- struct dt_object *dt,
- struct thandle *th)
+ struct dt_object *dt,
+ struct thandle *th)
{
- LASSERT(dt);
- LASSERT(dt->do_ops);
- LASSERT(dt->do_ops->do_destroy);
+ LASSERT(dt);
+ LASSERT(dt->do_ops);
+ LASSERT(dt->do_ops->do_destroy);
if (CFS_FAULT_CHECK(OBD_FAIL_DT_DESTROY))
return cfs_fail_err;
- return dt->do_ops->do_destroy(env, dt, th);
+ return dt->do_ops->do_destroy(env, dt, th);
}
static inline void dt_read_lock(const struct lu_env *env,
- struct dt_object *dt,
- unsigned role)
+ struct dt_object *dt,
+ unsigned int role)
{
- LASSERT(dt);
- LASSERT(dt->do_ops);
- LASSERT(dt->do_ops->do_read_lock);
- dt->do_ops->do_read_lock(env, dt, role);
+ LASSERT(dt);
+ LASSERT(dt->do_ops);
+ LASSERT(dt->do_ops->do_read_lock);
+ dt->do_ops->do_read_lock(env, dt, role);
}
static inline void dt_write_lock(const struct lu_env *env,
- struct dt_object *dt,
- unsigned role)
+ struct dt_object *dt,
+ unsigned int role)
{
- LASSERT(dt);
- LASSERT(dt->do_ops);
- LASSERT(dt->do_ops->do_write_lock);
- dt->do_ops->do_write_lock(env, dt, role);
+ LASSERT(dt);
+ LASSERT(dt->do_ops);
+ LASSERT(dt->do_ops->do_write_lock);
+ dt->do_ops->do_write_lock(env, dt, role);
}
static inline void dt_read_unlock(const struct lu_env *env,
- struct dt_object *dt)
+ struct dt_object *dt)
{
- LASSERT(dt);
- LASSERT(dt->do_ops);
- LASSERT(dt->do_ops->do_read_unlock);
- dt->do_ops->do_read_unlock(env, dt);
+ LASSERT(dt);
+ LASSERT(dt->do_ops);
+ LASSERT(dt->do_ops->do_read_unlock);
+ dt->do_ops->do_read_unlock(env, dt);
}
static inline void dt_write_unlock(const struct lu_env *env,
- struct dt_object *dt)
+ struct dt_object *dt)
{
- LASSERT(dt);
- LASSERT(dt->do_ops);
- LASSERT(dt->do_ops->do_write_unlock);
- dt->do_ops->do_write_unlock(env, dt);
+ LASSERT(dt);
+ LASSERT(dt->do_ops);
+ LASSERT(dt->do_ops->do_write_unlock);
+ dt->do_ops->do_write_unlock(env, dt);
}
static inline int dt_write_locked(const struct lu_env *env,
- struct dt_object *dt)
+ struct dt_object *dt)
{
- LASSERT(dt);
- LASSERT(dt->do_ops);
- LASSERT(dt->do_ops->do_write_locked);
- return dt->do_ops->do_write_locked(env, dt);
+ LASSERT(dt);
+ LASSERT(dt->do_ops);
+ LASSERT(dt->do_ops->do_write_locked);
+ return dt->do_ops->do_write_locked(env, dt);
}
static inline bool dt_object_stale(struct dt_object *dt)
static inline int dt_attr_get(const struct lu_env *env, struct dt_object *dt,
struct lu_attr *la)
{
- LASSERT(dt);
- LASSERT(dt->do_ops);
- LASSERT(dt->do_ops->do_attr_get);
+ LASSERT(dt);
+ LASSERT(dt->do_ops);
+ LASSERT(dt->do_ops->do_attr_get);
if (CFS_FAULT_CHECK(OBD_FAIL_DT_ATTR_GET))
return cfs_fail_err;
}
static inline int dt_declare_attr_set(const struct lu_env *env,
- struct dt_object *dt,
- const struct lu_attr *la,
- struct thandle *th)
+ struct dt_object *dt,
+ const struct lu_attr *la,
+ struct thandle *th)
{
- LASSERT(dt);
- LASSERT(dt->do_ops);
- LASSERT(dt->do_ops->do_declare_attr_set);
+ LASSERT(dt);
+ LASSERT(dt->do_ops);
+ LASSERT(dt->do_ops->do_declare_attr_set);
if (CFS_FAULT_CHECK(OBD_FAIL_DT_DECLARE_ATTR_SET))
return cfs_fail_err;
- return dt->do_ops->do_declare_attr_set(env, dt, la, th);
+ return dt->do_ops->do_declare_attr_set(env, dt, la, th);
}
static inline int dt_attr_set(const struct lu_env *env, struct dt_object *dt,
const struct lu_attr *la, struct thandle *th)
{
- LASSERT(dt);
- LASSERT(dt->do_ops);
- LASSERT(dt->do_ops->do_attr_set);
+ LASSERT(dt);
+ LASSERT(dt->do_ops);
+ LASSERT(dt->do_ops->do_attr_set);
if (CFS_FAULT_CHECK(OBD_FAIL_DT_ATTR_SET))
return cfs_fail_err;
}
static inline int dt_declare_ref_add(const struct lu_env *env,
- struct dt_object *dt, struct thandle *th)
+ struct dt_object *dt, struct thandle *th)
{
- LASSERT(dt);
- LASSERT(dt->do_ops);
- LASSERT(dt->do_ops->do_declare_ref_add);
+ LASSERT(dt);
+ LASSERT(dt->do_ops);
+ LASSERT(dt->do_ops->do_declare_ref_add);
if (CFS_FAULT_CHECK(OBD_FAIL_DT_DECLARE_REF_ADD))
return cfs_fail_err;
- return dt->do_ops->do_declare_ref_add(env, dt, th);
+ return dt->do_ops->do_declare_ref_add(env, dt, th);
}
static inline int dt_ref_add(const struct lu_env *env,
- struct dt_object *dt, struct thandle *th)
+ struct dt_object *dt, struct thandle *th)
{
- LASSERT(dt);
- LASSERT(dt->do_ops);
- LASSERT(dt->do_ops->do_ref_add);
+ LASSERT(dt);
+ LASSERT(dt->do_ops);
+ LASSERT(dt->do_ops->do_ref_add);
if (CFS_FAULT_CHECK(OBD_FAIL_DT_REF_ADD))
return cfs_fail_err;
- return dt->do_ops->do_ref_add(env, dt, th);
+ return dt->do_ops->do_ref_add(env, dt, th);
}
static inline int dt_declare_ref_del(const struct lu_env *env,
- struct dt_object *dt, struct thandle *th)
+ struct dt_object *dt, struct thandle *th)
{
- LASSERT(dt);
- LASSERT(dt->do_ops);
- LASSERT(dt->do_ops->do_declare_ref_del);
+ LASSERT(dt);
+ LASSERT(dt->do_ops);
+ LASSERT(dt->do_ops->do_declare_ref_del);
if (CFS_FAULT_CHECK(OBD_FAIL_DT_DECLARE_REF_DEL))
return cfs_fail_err;
- return dt->do_ops->do_declare_ref_del(env, dt, th);
+ return dt->do_ops->do_declare_ref_del(env, dt, th);
}
static inline int dt_ref_del(const struct lu_env *env,
- struct dt_object *dt, struct thandle *th)
+ struct dt_object *dt, struct thandle *th)
{
- LASSERT(dt);
- LASSERT(dt->do_ops);
- LASSERT(dt->do_ops->do_ref_del);
+ LASSERT(dt);
+ LASSERT(dt->do_ops);
+ LASSERT(dt->do_ops->do_ref_del);
if (CFS_FAULT_CHECK(OBD_FAIL_DT_REF_DEL))
return cfs_fail_err;
- return dt->do_ops->do_ref_del(env, dt, th);
+ return dt->do_ops->do_ref_del(env, dt, th);
}
static inline int dt_bufs_get(const struct lu_env *env, struct dt_object *d,
}
static inline int dt_bufs_put(const struct lu_env *env, struct dt_object *d,
- struct niobuf_local *lnb, int n)
+ struct niobuf_local *lnb, int n)
{
- LASSERT(d);
- LASSERT(d->do_body_ops);
- LASSERT(d->do_body_ops->dbo_bufs_put);
- return d->do_body_ops->dbo_bufs_put(env, d, lnb, n);
+ LASSERT(d);
+ LASSERT(d->do_body_ops);
+ LASSERT(d->do_body_ops->dbo_bufs_put);
+ return d->do_body_ops->dbo_bufs_put(env, d, lnb, n);
}
static inline int dt_write_prep(const struct lu_env *env, struct dt_object *d,
- struct niobuf_local *lnb, int n)
+ struct niobuf_local *lnb, int n)
{
- LASSERT(d);
- LASSERT(d->do_body_ops);
- LASSERT(d->do_body_ops->dbo_write_prep);
- return d->do_body_ops->dbo_write_prep(env, d, lnb, n);
+ LASSERT(d);
+ LASSERT(d->do_body_ops);
+ LASSERT(d->do_body_ops->dbo_write_prep);
+ return d->do_body_ops->dbo_write_prep(env, d, lnb, n);
}
static inline int dt_declare_write_commit(const struct lu_env *env,
- struct dt_object *d,
- struct niobuf_local *lnb,
- int n, struct thandle *th)
+ struct dt_object *d,
+ struct niobuf_local *lnb,
+ int n, struct thandle *th)
{
- LASSERTF(d != NULL, "dt is NULL when we want to declare write\n");
- LASSERT(th != NULL);
- return d->do_body_ops->dbo_declare_write_commit(env, d, lnb, n, th);
+ LASSERTF(d != NULL, "dt is NULL when we want to declare write\n");
+ LASSERT(th != NULL);
+ return d->do_body_ops->dbo_declare_write_commit(env, d, lnb, n, th);
}
}
static inline int dt_read_prep(const struct lu_env *env, struct dt_object *d,
- struct niobuf_local *lnb, int n)
+ struct niobuf_local *lnb, int n)
{
- LASSERT(d);
- LASSERT(d->do_body_ops);
- LASSERT(d->do_body_ops->dbo_read_prep);
- return d->do_body_ops->dbo_read_prep(env, d, lnb, n);
+ LASSERT(d);
+ LASSERT(d->do_body_ops);
+ LASSERT(d->do_body_ops->dbo_read_prep);
+ return d->do_body_ops->dbo_read_prep(env, d, lnb, n);
}
static inline int dt_declare_write(const struct lu_env *env,
}
static inline int dt_declare_punch(const struct lu_env *env,
- struct dt_object *dt, __u64 start,
- __u64 end, struct thandle *th)
+ struct dt_object *dt, __u64 start,
+ __u64 end, struct thandle *th)
{
- LASSERT(dt);
- LASSERT(dt->do_body_ops);
- LASSERT(dt->do_body_ops->dbo_declare_punch);
- return dt->do_body_ops->dbo_declare_punch(env, dt, start, end, th);
+ LASSERT(dt);
+ LASSERT(dt->do_body_ops);
+ LASSERT(dt->do_body_ops->dbo_declare_punch);
+ return dt->do_body_ops->dbo_declare_punch(env, dt, start, end, th);
}
static inline int dt_punch(const struct lu_env *env, struct dt_object *dt,
__u64 start, __u64 end, struct thandle *th)
{
- LASSERT(dt);
- LASSERT(dt->do_body_ops);
- LASSERT(dt->do_body_ops->dbo_punch);
+ LASSERT(dt);
+ LASSERT(dt->do_body_ops);
+ LASSERT(dt->do_body_ops->dbo_punch);
return dt->do_body_ops->dbo_punch(env, dt, start, end, th);
}
static inline int dt_fiemap_get(const struct lu_env *env, struct dt_object *d,
struct fiemap *fm)
{
- LASSERT(d);
- if (d->do_body_ops == NULL)
- return -EPROTO;
+ LASSERT(d);
+ if (d->do_body_ops == NULL)
+ return -EPROTO;
if (d->do_body_ops->dbo_fiemap_get == NULL)
return -EOPNOTSUPP;
- return d->do_body_ops->dbo_fiemap_get(env, d, fm);
+ return d->do_body_ops->dbo_fiemap_get(env, d, fm);
}
static inline loff_t dt_lseek(const struct lu_env *env, struct dt_object *d,
}
static inline int dt_root_get(const struct lu_env *env, struct dt_device *dev,
- struct lu_fid *f)
+ struct lu_fid *f)
{
- LASSERT(dev);
- LASSERT(dev->dd_ops);
- LASSERT(dev->dd_ops->dt_root_get);
- return dev->dd_ops->dt_root_get(env, dev, f);
+ LASSERT(dev);
+ LASSERT(dev->dd_ops);
+ LASSERT(dev->dd_ops->dt_root_get);
+ return dev->dd_ops->dt_root_get(env, dev, f);
}
static inline void dt_conf_get(const struct lu_env *env,
static inline int dt_sync(const struct lu_env *env, struct dt_device *dev)
{
- LASSERT(dev);
- LASSERT(dev->dd_ops);
- LASSERT(dev->dd_ops->dt_sync);
- return dev->dd_ops->dt_sync(env, dev);
+ LASSERT(dev);
+ LASSERT(dev->dd_ops);
+ LASSERT(dev->dd_ops->dt_sync);
+ return dev->dd_ops->dt_sync(env, dev);
}
static inline int dt_ro(const struct lu_env *env, struct dt_device *dev)
{
- LASSERT(dev);
- LASSERT(dev->dd_ops);
- LASSERT(dev->dd_ops->dt_ro);
- return dev->dd_ops->dt_ro(env, dev);
+ LASSERT(dev);
+ LASSERT(dev->dd_ops);
+ LASSERT(dev->dd_ops->dt_ro);
+ return dev->dd_ops->dt_ro(env, dev);
}
static inline int dt_declare_insert(const struct lu_env *env,
- struct dt_object *dt,
- const struct dt_rec *rec,
- const struct dt_key *key,
- struct thandle *th)
+ struct dt_object *dt,
+ const struct dt_rec *rec,
+ const struct dt_key *key,
+ struct thandle *th)
{
- LASSERT(dt);
- LASSERT(dt->do_index_ops);
- LASSERT(dt->do_index_ops->dio_declare_insert);
+ LASSERT(dt);
+ LASSERT(dt->do_index_ops);
+ LASSERT(dt->do_index_ops->dio_declare_insert);
if (CFS_FAULT_CHECK(OBD_FAIL_DT_DECLARE_INSERT))
return cfs_fail_err;
const struct dt_key *key,
struct thandle *th)
{
- LASSERT(dt);
- LASSERT(dt->do_index_ops);
- LASSERT(dt->do_index_ops->dio_insert);
+ LASSERT(dt);
+ LASSERT(dt->do_index_ops);
+ LASSERT(dt->do_index_ops->dio_insert);
if (CFS_FAULT_CHECK(OBD_FAIL_DT_INSERT))
return cfs_fail_err;
}
static inline int dt_declare_xattr_del(const struct lu_env *env,
- struct dt_object *dt,
- const char *name,
- struct thandle *th)
+ struct dt_object *dt,
+ const char *name,
+ struct thandle *th)
{
- LASSERT(dt);
- LASSERT(dt->do_ops);
- LASSERT(dt->do_ops->do_declare_xattr_del);
+ LASSERT(dt);
+ LASSERT(dt->do_ops);
+ LASSERT(dt->do_ops->do_declare_xattr_del);
if (CFS_FAULT_CHECK(OBD_FAIL_DT_DECLARE_XATTR_DEL))
return cfs_fail_err;
- return dt->do_ops->do_declare_xattr_del(env, dt, name, th);
+ return dt->do_ops->do_declare_xattr_del(env, dt, name, th);
}
static inline int dt_xattr_del(const struct lu_env *env,
struct dt_object *dt, const char *name,
struct thandle *th)
{
- LASSERT(dt);
- LASSERT(dt->do_ops);
- LASSERT(dt->do_ops->do_xattr_del);
+ LASSERT(dt);
+ LASSERT(dt->do_ops);
+ LASSERT(dt->do_ops->do_xattr_del);
if (CFS_FAULT_CHECK(OBD_FAIL_DT_XATTR_DEL))
return cfs_fail_err;
}
static inline int dt_declare_xattr_set(const struct lu_env *env,
- struct dt_object *dt,
- const struct lu_buf *buf,
- const char *name, int fl,
- struct thandle *th)
+ struct dt_object *dt,
+ const struct lu_buf *buf,
+ const char *name, int fl,
+ struct thandle *th)
{
- LASSERT(dt);
- LASSERT(dt->do_ops);
- LASSERT(dt->do_ops->do_declare_xattr_set);
+ LASSERT(dt);
+ LASSERT(dt->do_ops);
+ LASSERT(dt->do_ops->do_declare_xattr_set);
if (CFS_FAULT_CHECK(OBD_FAIL_DT_DECLARE_XATTR_SET))
return cfs_fail_err;
- return dt->do_ops->do_declare_xattr_set(env, dt, buf, name, fl, th);
+ return dt->do_ops->do_declare_xattr_set(env, dt, buf, name, fl, th);
}
static inline int dt_xattr_set(const struct lu_env *env,
struct dt_object *dt, const struct lu_buf *buf,
const char *name, int fl, struct thandle *th)
{
- LASSERT(dt);
- LASSERT(dt->do_ops);
- LASSERT(dt->do_ops->do_xattr_set);
+ LASSERT(dt);
+ LASSERT(dt->do_ops);
+ LASSERT(dt->do_ops->do_xattr_set);
if (CFS_FAULT_CHECK(OBD_FAIL_DT_XATTR_SET))
return cfs_fail_err;
struct dt_object *dt, struct lu_buf *buf,
const char *name)
{
- LASSERT(dt);
- LASSERT(dt->do_ops);
- LASSERT(dt->do_ops->do_xattr_get);
+ LASSERT(dt);
+ LASSERT(dt->do_ops);
+ LASSERT(dt->do_ops->do_xattr_get);
if (CFS_FAULT_CHECK(OBD_FAIL_DT_XATTR_GET))
return cfs_fail_err;
static inline int dt_xattr_list(const struct lu_env *env, struct dt_object *dt,
const struct lu_buf *buf)
{
- LASSERT(dt);
- LASSERT(dt->do_ops);
- LASSERT(dt->do_ops->do_xattr_list);
+ LASSERT(dt);
+ LASSERT(dt->do_ops);
+ LASSERT(dt->do_ops->do_xattr_list);
if (CFS_FAULT_CHECK(OBD_FAIL_DT_XATTR_LIST))
return cfs_fail_err;
}
static inline int dt_declare_delete(const struct lu_env *env,
- struct dt_object *dt,
- const struct dt_key *key,
- struct thandle *th)
+ struct dt_object *dt,
+ const struct dt_key *key,
+ struct thandle *th)
{
- LASSERT(dt);
- LASSERT(dt->do_index_ops);
- LASSERT(dt->do_index_ops->dio_declare_delete);
+ LASSERT(dt);
+ LASSERT(dt->do_index_ops);
+ LASSERT(dt->do_index_ops->dio_declare_delete);
if (CFS_FAULT_CHECK(OBD_FAIL_DT_DECLARE_DELETE))
return cfs_fail_err;
- return dt->do_index_ops->dio_declare_delete(env, dt, key, th);
+ return dt->do_index_ops->dio_declare_delete(env, dt, key, th);
}
static inline int dt_delete(const struct lu_env *env,
const struct dt_key *key,
struct thandle *th)
{
- LASSERT(dt);
- LASSERT(dt->do_index_ops);
- LASSERT(dt->do_index_ops->dio_delete);
+ LASSERT(dt);
+ LASSERT(dt->do_index_ops);
+ LASSERT(dt->do_index_ops->dio_delete);
if (CFS_FAULT_CHECK(OBD_FAIL_DT_DELETE))
return cfs_fail_err;
}
static inline int dt_commit_async(const struct lu_env *env,
- struct dt_device *dev)
+ struct dt_device *dev)
{
- LASSERT(dev);
- LASSERT(dev->dd_ops);
- LASSERT(dev->dd_ops->dt_commit_async);
- return dev->dd_ops->dt_commit_async(env, dev);
+ LASSERT(dev);
+ LASSERT(dev->dd_ops);
+ LASSERT(dev->dd_ops->dt_commit_async);
+ return dev->dd_ops->dt_commit_async(env, dev);
}
static inline int dt_reserve_or_free_quota(const struct lu_env *env,
struct dt_rec *rec,
const struct dt_key *key)
{
- int ret;
+ int ret;
- LASSERT(dt);
- LASSERT(dt->do_index_ops);
- LASSERT(dt->do_index_ops->dio_lookup);
+ LASSERT(dt);
+ LASSERT(dt->do_index_ops);
+ LASSERT(dt->do_index_ops->dio_lookup);
if (CFS_FAULT_CHECK(OBD_FAIL_DT_LOOKUP))
return cfs_fail_err;
ret = dt->do_index_ops->dio_lookup(env, dt, rec, key);
- if (ret > 0)
- ret = 0;
- else if (ret == 0)
- ret = -ENOENT;
- return ret;
+ if (ret > 0)
+ ret = 0;
+ else if (ret == 0)
+ ret = -ENOENT;
+ return ret;
}
static inline int dt_declare_layout_change(const struct lu_env *env,