X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Finclude%2Fdt_object.h;h=9e9f1db63940ddf0ef39d5407412bfea2daf00b2;hp=c79cc0263a606a89f25f06df8f30f779afd5ef4d;hb=e2ac6e1eaa108eef3493837e9bd881629582ea1d;hpb=434eeba4d33d9ddd871cff080d51534081bb3d30 diff --git a/lustre/include/dt_object.h b/lustre/include/dt_object.h index c79cc02..9e9f1db 100644 --- a/lustre/include/dt_object.h +++ b/lustre/include/dt_object.h @@ -23,7 +23,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2016, Intel Corporation. + * Copyright (c) 2011, 2017, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -84,7 +84,10 @@ struct dt_device_param { unsigned ddp_max_extent_blks; /* per-extent insertion overhead to be used by client for grant * calculation */ - unsigned ddp_extent_tax; + 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; }; /** @@ -130,7 +133,8 @@ struct dt_device_operations { */ 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. @@ -251,6 +255,13 @@ struct dt_device_operations { 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 @@ -336,6 +347,16 @@ enum dt_index_flags { DT_IND_RANGE = 1 << 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, +}; + /** * Features, required from index to support file system directories (mapping * names to fids). @@ -368,6 +389,8 @@ struct dt_allocation_hint { const void *dah_eadata; int dah_eadata_len; __u32 dah_mode; + int dah_append_stripes; + char *dah_append_pool; }; /** @@ -415,6 +438,8 @@ typedef __u64 dt_obj_version_t; union ldlm_policy_data; +struct md_layout_change; + /** * A dt_object provides common operations to create and destroy * objects and to manage regular and extended attributes. @@ -1039,8 +1064,7 @@ struct dt_object_operations { */ int (*do_declare_layout_change)(const struct lu_env *env, struct dt_object *dt, - struct layout_intent *layout, - const struct lu_buf *buf, + struct md_layout_change *mlc, struct thandle *th); /** @@ -1056,8 +1080,15 @@ struct dt_object_operations { * \retval -ne error code */ int (*do_layout_change)(const struct lu_env *env, struct dt_object *dt, - struct layout_intent *layout, - const struct lu_buf *buf, struct thandle *th); + struct md_layout_change *mlc, + struct thandle *th); +}; + +enum dt_bufs_type { + DT_BUFS_TYPE_READ = 0x0000, + DT_BUFS_TYPE_WRITE = 0x0001, + DT_BUFS_TYPE_READAHEAD = 0x0002, + DT_BUFS_TYPE_LOCAL = 0x0004, }; /** @@ -1128,7 +1159,6 @@ struct dt_body_operations { * \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 @@ -1137,8 +1167,7 @@ struct dt_body_operations { struct dt_object *dt, const struct lu_buf *buf, loff_t *pos, - struct thandle *th, - int ignore); + struct thandle *th); /** * Return buffers for data. @@ -1177,7 +1206,7 @@ struct dt_body_operations { loff_t pos, ssize_t len, struct niobuf_local *lb, - int rw); + enum dt_bufs_type rw); /** * Release reference granted by ->dbo_bufs_get(). @@ -1471,7 +1500,6 @@ struct dt_index_operations { * \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 @@ -1480,8 +1508,7 @@ struct dt_index_operations { 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. @@ -1774,6 +1801,14 @@ struct dt_device { 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); @@ -1878,11 +1913,6 @@ struct thandle { * top thandle here for now, will fix it when we have better * callback mechanism */ struct thandle *th_top; - /** context for this transaction, tag is LCT_TX_HANDLE */ - struct lu_context th_ctx; - - /** additional tags (layers can add in declare) */ - __u32 th_tags; /** the last operation result in this transaction. * this value is used in recovery */ @@ -1897,7 +1927,9 @@ struct thandle { th_wait_submit:1, /* complex transaction which will track updates on all targets, * including OSTs */ - th_complex:1; + th_complex:1, + /* whether ignore quota */ + th_ignore_quota:1; }; /** @@ -1916,7 +1948,6 @@ struct dt_txn_callback { 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; @@ -1928,7 +1959,6 @@ 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); 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); @@ -2379,7 +2409,7 @@ static inline int dt_ref_del(const struct lu_env *env, static inline int dt_bufs_get(const struct lu_env *env, struct dt_object *d, struct niobuf_remote *rnb, - struct niobuf_local *lnb, int rw) + struct niobuf_local *lnb, enum dt_bufs_type rw) { LASSERT(d); LASSERT(d->do_body_ops); @@ -2449,12 +2479,12 @@ static inline int dt_declare_write(const struct lu_env *env, 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, @@ -2496,13 +2526,21 @@ static inline int dt_fiemap_get(const struct lu_env *env, struct dt_object *d, 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, @@ -2524,6 +2562,16 @@ static inline void dt_conf_get(const struct lu_env *env, 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); @@ -2557,11 +2605,10 @@ static inline int dt_declare_insert(const struct lu_env *env, } 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); @@ -2570,7 +2617,7 @@ static inline int dt_insert(const struct lu_env *env, 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, @@ -2746,26 +2793,24 @@ static inline int dt_lookup(const struct lu_env *env, static inline int dt_declare_layout_change(const struct lu_env *env, struct dt_object *o, - struct layout_intent *layout, - const struct lu_buf *buf, + struct md_layout_change *mlc, struct thandle *th) { LASSERT(o); LASSERT(o->do_ops); LASSERT(o->do_ops->do_declare_layout_change); - return o->do_ops->do_declare_layout_change(env, o, layout, buf, th); + return o->do_ops->do_declare_layout_change(env, o, mlc, th); } static inline int dt_layout_change(const struct lu_env *env, struct dt_object *o, - struct layout_intent *layout, - const struct lu_buf *buf, + struct md_layout_change *mlc, struct thandle *th) { LASSERT(o); LASSERT(o->do_ops); LASSERT(o->do_ops->do_layout_change); - return o->do_ops->do_layout_change(env, o, layout, buf, th); + return o->do_ops->do_layout_change(env, o, mlc, th); } struct dt_find_hint { @@ -2814,6 +2859,9 @@ static inline struct dt_thread_info *dt_info(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);