- make FMD structures common for all targets
- adapt FMD functionality to be isolated from OFD for
further move to the target code.
Lustre-change: https://review.whamcloud.com/34176
Lustre-commit:
6459fa2b458612b5213b3b70839e340efff7aebc
Signed-off-by: Mikhail Pershin <mpershin@whamcloud.com>
Change-Id: I9f67f14e4132205cca67aa778b990bb3b45c30be
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Signed-off-by: Minh Diep <mdiep@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/34690
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
/* target grants fields */
struct tg_grants_data lut_tgd;
/* target grants fields */
struct tg_grants_data lut_tgd;
+
+ /* FMD (file modification data) values */
+ int lut_fmd_max_num;
+ time64_t lut_fmd_max_age;
+#define LUT_FMD_MAX_NUM_DEFAULT 128
+#define LUT_FMD_MAX_AGE_DEFAULT (obd_timeout + 10)
+
/* number of slots in reply bitmap */
#define LUT_REPLY_SLOTS_PER_CHUNK (1<<20)
#define LUT_REPLY_SLOTS_MAX_CHUNKS 16
/* number of slots in reply bitmap */
#define LUT_REPLY_SLOTS_PER_CHUNK (1<<20)
#define LUT_REPLY_SLOTS_MAX_CHUNKS 16
const char __user *buffer,
size_t count, loff_t *off);
const char __user *buffer,
size_t count, loff_t *off);
+/* FMD */
+void tgt_fmd_update(struct obd_export *exp, const struct lu_fid *fid,
+ __u64 xid);
+bool tgt_fmd_check(struct obd_export *exp, const struct lu_fid *fid,
+ __u64 xid);
+
/* target/update_trans.c */
int distribute_txn_init(const struct lu_env *env,
struct lu_target *lut,
/* target/update_trans.c */
int distribute_txn_init(const struct lu_env *env,
struct lu_target *lut,
long ted_grant; /* in bytes */
long ted_pending; /* bytes just being written */
__u8 ted_pagebits; /* log2 of client page size */
long ted_grant; /* in bytes */
long ted_pending; /* bytes just being written */
__u8 ted_pagebits; /* log2 of client page size */
+
+ /**
+ * File Modification Data (FMD) tracking
+ */
+ spinlock_t ted_fmd_lock; /* protects ted_fmd_list */
+ struct list_head ted_fmd_list; /* FIDs being modified */
+ int ted_fmd_count;/* items in ted_fmd_list */
/** Filter (oss-side) specific import data */
struct filter_export_data {
struct tg_export_data fed_ted;
/** Filter (oss-side) specific import data */
struct filter_export_data {
struct tg_export_data fed_ted;
- spinlock_t fed_lock; /**< protects fed_mod_list */
- struct list_head fed_mod_list; /* files being modified */
/* count of SOFT_SYNC RPCs, which will be reset after
* ofd_soft_sync_limit number of RPCs, and trigger a sync. */
atomic_t fed_soft_sync_count;
/* count of SOFT_SYNC RPCs, which will be reset after
* ofd_soft_sync_limit number of RPCs, and trigger a sync. */
atomic_t fed_soft_sync_count;
- int fed_mod_count;/* items in fed_writing list */
{
struct obd_device *obd = container_of(kobj, struct obd_device,
obd_kset.kobj);
{
struct obd_device *obd = container_of(kobj, struct obd_device,
obd_kset.kobj);
- struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+ struct lu_target *lut = obd->u.obt.obt_lut;
- return sprintf(buf, "%u\n", ofd->ofd_fmd_max_num);
+ return sprintf(buf, "%u\n", lut->lut_fmd_max_num);
{
struct obd_device *obd = container_of(kobj, struct obd_device,
obd_kset.kobj);
{
struct obd_device *obd = container_of(kobj, struct obd_device,
obd_kset.kobj);
- struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+ struct lu_target *lut = obd->u.obt.obt_lut;
if (val < 1 || val > 65536)
return -EINVAL;
if (val < 1 || val > 65536)
return -EINVAL;
- ofd->ofd_fmd_max_num = val;
+ lut->lut_fmd_max_num = val;
return count;
}
LUSTRE_RW_ATTR(client_cache_count);
return count;
}
LUSTRE_RW_ATTR(client_cache_count);
{
struct obd_device *obd = container_of(kobj, struct obd_device,
obd_kset.kobj);
{
struct obd_device *obd = container_of(kobj, struct obd_device,
obd_kset.kobj);
- struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+ struct lu_target *lut = obd->u.obt.obt_lut;
- return sprintf(buf, "%lld\n", ofd->ofd_fmd_max_age);
+ return sprintf(buf, "%lld\n", lut->lut_fmd_max_age);
{
struct obd_device *obd = container_of(kobj, struct obd_device,
obd_kset.kobj);
{
struct obd_device *obd = container_of(kobj, struct obd_device,
obd_kset.kobj);
- struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+ struct lu_target *lut = obd->u.obt.obt_lut;
if (val < 1 || val > 65536) /* ~ 18 hour max */
return -EINVAL;
if (val < 1 || val > 65536) /* ~ 18 hour max */
return -EINVAL;
- ofd->ofd_fmd_max_age = val;
+ lut->lut_fmd_max_age = val;
return count;
}
LUSTRE_RW_ATTR(client_cache_seconds);
return count;
}
LUSTRE_RW_ATTR(client_cache_seconds);
/* Slab for OFD object allocation */
static struct kmem_cache *ofd_object_kmem;
/* Slab for OFD object allocation */
static struct kmem_cache *ofd_object_kmem;
+struct kmem_cache *tgt_fmd_kmem;
static struct lu_kmem_descr ofd_caches[] = {
{
static struct lu_kmem_descr ofd_caches[] = {
{
.ckd_size = sizeof(struct ofd_object)
},
{
.ckd_size = sizeof(struct ofd_object)
},
{
+ .ckd_cache = &tgt_fmd_kmem,
+ .ckd_name = "ll_fmd_cache",
+ .ckd_size = sizeof(struct tgt_fmd_data)
+ },
+ {
obt = &obd->u.obt;
obt->obt_magic = OBT_MAGIC;
obt = &obd->u.obt;
obt->obt_magic = OBT_MAGIC;
- m->ofd_fmd_max_num = OFD_FMD_MAX_NUM_DEFAULT;
- m->ofd_fmd_max_age = OFD_FMD_MAX_AGE_DEFAULT;
-
spin_lock_init(&m->ofd_flags_lock);
m->ofd_raid_degraded = 0;
m->ofd_checksum_t10pi_enforce = 0;
spin_lock_init(&m->ofd_flags_lock);
m->ofd_raid_degraded = 0;
m->ofd_checksum_t10pi_enforce = 0;
rc = lu_kmem_init(ofd_caches);
if (rc)
return rc;
rc = lu_kmem_init(ofd_caches);
if (rc)
return rc;
-
- rc = ofd_fmd_init();
- if (rc) {
- lu_kmem_fini(ofd_caches);
- return(rc);
- }
-
rc = class_register_type(&ofd_obd_ops, NULL, true, NULL,
LUSTRE_OST_NAME, &ofd_device_type);
return rc;
rc = class_register_type(&ofd_obd_ops, NULL, true, NULL,
LUSTRE_OST_NAME, &ofd_device_type);
return rc;
*/
static void __exit ofd_exit(void)
{
*/
static void __exit ofd_exit(void)
{
lu_kmem_fini(ofd_caches);
class_unregister_type(LUSTRE_OST_NAME);
}
lu_kmem_fini(ofd_caches);
class_unregister_type(LUSTRE_OST_NAME);
}
#include "ofd_internal.h"
#include "ofd_internal.h"
-static struct kmem_cache *ll_fmd_cachep;
-
/**
* Drop FMD reference and free it if reference drops to zero.
*
/**
* Drop FMD reference and free it if reference drops to zero.
*
- * Must be called with fed_lock held.
+ * Must be called with ted_fmd_lock held.
*
* \param[in] exp OBD export
* \param[in] fmd FMD to put
*/
static inline void ofd_fmd_put_nolock(struct obd_export *exp,
*
* \param[in] exp OBD export
* \param[in] fmd FMD to put
*/
static inline void ofd_fmd_put_nolock(struct obd_export *exp,
- struct ofd_mod_data *fmd)
+ struct tgt_fmd_data *fmd)
- struct filter_export_data *fed = &exp->exp_filter_data;
+ struct tg_export_data *ted = &exp->exp_target_data;
- assert_spin_locked(&fed->fed_lock);
+ assert_spin_locked(&ted->ted_fmd_lock);
if (--fmd->fmd_refcount == 0) {
if (--fmd->fmd_refcount == 0) {
- /* XXX when we have persistent reservations and the handle
- * is stored herein we need to drop it here. */
- fed->fed_mod_count--;
list_del(&fmd->fmd_list);
list_del(&fmd->fmd_list);
- OBD_SLAB_FREE(fmd, ll_fmd_cachep, sizeof(*fmd));
+ OBD_SLAB_FREE_PTR(fmd, tgt_fmd_kmem);
- * Wrapper to drop FMD reference with fed_lock held.
+ * Wrapper to drop FMD reference with ted_fmd_lock held.
*
* \param[in] exp OBD export
* \param[in] fmd FMD to put
*/
*
* \param[in] exp OBD export
* \param[in] fmd FMD to put
*/
-void ofd_fmd_put(struct obd_export *exp, struct ofd_mod_data *fmd)
+void ofd_fmd_put(struct obd_export *exp, struct tgt_fmd_data *fmd)
- struct filter_export_data *fed = &exp->exp_filter_data;
-
- if (fmd == NULL)
- return;
+ struct tg_export_data *ted = &exp->exp_target_data;
- spin_lock(&fed->fed_lock);
+ spin_lock(&ted->ted_fmd_lock);
ofd_fmd_put_nolock(exp, fmd); /* caller reference */
ofd_fmd_put_nolock(exp, fmd); /* caller reference */
- spin_unlock(&fed->fed_lock);
+ spin_unlock(&ted->ted_fmd_lock);
* Expire entries from the FMD list if there are too many
* of them or they are too old.
*
* Expire entries from the FMD list if there are too many
* of them or they are too old.
*
- * This function must be called with fed_lock held.
+ * This function must be called with ted_fmd_lock held.
*
* The \a keep FMD is not to be expired in any case. This parameter is used
* by ofd_fmd_find_nolock() to prohibit a FMD that was just found from
*
* The \a keep FMD is not to be expired in any case. This parameter is used
* by ofd_fmd_find_nolock() to prohibit a FMD that was just found from
* \param[in] keep FMD to keep always
*/
static void ofd_fmd_expire_nolock(struct obd_export *exp,
* \param[in] keep FMD to keep always
*/
static void ofd_fmd_expire_nolock(struct obd_export *exp,
- struct ofd_mod_data *keep)
+ struct tgt_fmd_data *keep)
- struct filter_export_data *fed = &exp->exp_filter_data;
- struct ofd_device *ofd = ofd_exp(exp);
+ struct tg_export_data *ted = &exp->exp_target_data;
+ struct lu_target *lut = exp->exp_obd->u.obt.obt_lut;
time64_t now = ktime_get_seconds();
time64_t now = ktime_get_seconds();
- struct ofd_mod_data *fmd, *tmp;
+ struct tgt_fmd_data *fmd, *tmp;
- list_for_each_entry_safe(fmd, tmp, &fed->fed_mod_list, fmd_list) {
+ list_for_each_entry_safe(fmd, tmp, &ted->ted_fmd_list, fmd_list) {
if (fmd == keep)
break;
if (now < fmd->fmd_expire &&
if (fmd == keep)
break;
if (now < fmd->fmd_expire &&
- fed->fed_mod_count < ofd->ofd_fmd_max_num)
+ ted->ted_fmd_count < lut->lut_fmd_max_num)
break;
list_del_init(&fmd->fmd_list);
break;
list_del_init(&fmd->fmd_list);
*/
void ofd_fmd_expire(struct obd_export *exp)
{
*/
void ofd_fmd_expire(struct obd_export *exp)
{
- struct filter_export_data *fed = &exp->exp_filter_data;
+ struct tg_export_data *ted = &exp->exp_target_data;
- spin_lock(&fed->fed_lock);
+ spin_lock(&ted->ted_fmd_lock);
ofd_fmd_expire_nolock(exp, NULL);
ofd_fmd_expire_nolock(exp, NULL);
- spin_unlock(&fed->fed_lock);
+ spin_unlock(&ted->ted_fmd_lock);
}
/**
* Find FMD by specified FID.
*
}
/**
* Find FMD by specified FID.
*
- * Function finds FMD entry by FID in the filter_export_data::fed_fmd_list.
+ * Function finds FMD entry by FID in the tg_export_data::ted_fmd_list.
- * Caller must hold filter_export_data::fed_lock and take FMD reference.
+ * Caller must hold tg_export_data::ted_fmd_lock and take FMD reference.
*
* \param[in] exp OBD export
* \param[in] fid FID of FMD to find
*
*
* \param[in] exp OBD export
* \param[in] fid FID of FMD to find
*
- * \retval struct ofd_mod_data found by FID
+ * \retval struct tgt_fmd_data found by FID
* \retval NULL is FMD is not found
*/
* \retval NULL is FMD is not found
*/
-static struct ofd_mod_data *ofd_fmd_find_nolock(struct obd_export *exp,
+static struct tgt_fmd_data *ofd_fmd_find_nolock(struct obd_export *exp,
const struct lu_fid *fid)
{
const struct lu_fid *fid)
{
- struct filter_export_data *fed = &exp->exp_filter_data;
- struct ofd_mod_data *found = NULL, *fmd;
- struct ofd_device *ofd = ofd_exp(exp);
- time64_t now = ktime_get_seconds();
+ struct tg_export_data *ted = &exp->exp_target_data;
+ struct tgt_fmd_data *found = NULL, *fmd;
+ struct lu_target *lut = exp->exp_obd->u.obt.obt_lut;
- assert_spin_locked(&fed->fed_lock);
+ assert_spin_locked(&ted->ted_fmd_lock);
- list_for_each_entry_reverse(fmd, &fed->fed_mod_list, fmd_list) {
+ list_for_each_entry_reverse(fmd, &ted->ted_fmd_list, fmd_list) {
if (lu_fid_eq(&fmd->fmd_fid, fid)) {
found = fmd;
if (lu_fid_eq(&fmd->fmd_fid, fid)) {
found = fmd;
- list_del(&fmd->fmd_list);
- list_add_tail(&fmd->fmd_list, &fed->fed_mod_list);
- fmd->fmd_expire = now + ofd->ofd_fmd_max_age;
+ list_move_tail(&fmd->fmd_list, &ted->ted_fmd_list);
+ fmd->fmd_expire = ktime_get_seconds() +
+ lut->lut_fmd_max_age;
* \param[in] exp OBD export
* \param[in] fid FID of FMD to find
*
* \param[in] exp OBD export
* \param[in] fid FID of FMD to find
*
- * \retval struct ofd_mod_data found by FID
+ * \retval struct tgt_fmd_data found by FID
* \retval NULL indicates FMD is not found
*/
* \retval NULL indicates FMD is not found
*/
-struct ofd_mod_data *ofd_fmd_find(struct obd_export *exp,
+struct tgt_fmd_data *ofd_fmd_find(struct obd_export *exp,
const struct lu_fid *fid)
{
const struct lu_fid *fid)
{
- struct filter_export_data *fed = &exp->exp_filter_data;
- struct ofd_mod_data *fmd;
+ struct tg_export_data *ted = &exp->exp_target_data;
+ struct tgt_fmd_data *fmd;
- spin_lock(&fed->fed_lock);
+ spin_lock(&ted->ted_fmd_lock);
fmd = ofd_fmd_find_nolock(exp, fid);
if (fmd)
fmd->fmd_refcount++; /* caller reference */
fmd = ofd_fmd_find_nolock(exp, fid);
if (fmd)
fmd->fmd_refcount++; /* caller reference */
- spin_unlock(&fed->fed_lock);
+ spin_unlock(&ted->ted_fmd_lock);
* \param[in] exp OBD export
* \param[in] fid FID of FMD to find
*
* \param[in] exp OBD export
* \param[in] fid FID of FMD to find
*
- * \retval struct ofd_mod_data found by FID
+ * \retval struct tgt_fmd_data found by FID
* \retval NULL indicates FMD is not found
*/
* \retval NULL indicates FMD is not found
*/
-struct ofd_mod_data *ofd_fmd_get(struct obd_export *exp, const struct lu_fid *fid)
+struct tgt_fmd_data *ofd_fmd_get(struct obd_export *exp,
+ const struct lu_fid *fid)
- struct filter_export_data *fed = &exp->exp_filter_data;
- struct ofd_device *ofd = ofd_exp(exp);
- struct ofd_mod_data *found = NULL, *fmd_new = NULL;
- time64_t now = ktime_get_seconds();
+ struct tg_export_data *ted = &exp->exp_target_data;
+ struct tgt_fmd_data *found = NULL, *fmd_new = NULL;
- OBD_SLAB_ALLOC_PTR(fmd_new, ll_fmd_cachep);
+ OBD_SLAB_ALLOC_PTR(fmd_new, tgt_fmd_kmem);
- spin_lock(&fed->fed_lock);
+ spin_lock(&ted->ted_fmd_lock);
found = ofd_fmd_find_nolock(exp, fid);
if (fmd_new) {
if (found == NULL) {
found = ofd_fmd_find_nolock(exp, fid);
if (fmd_new) {
if (found == NULL) {
- list_add_tail(&fmd_new->fmd_list,
- &fed->fed_mod_list);
+ list_add_tail(&fmd_new->fmd_list, &ted->ted_fmd_list);
fmd_new->fmd_fid = *fid;
fmd_new->fmd_refcount++; /* list reference */
found = fmd_new;
fmd_new->fmd_fid = *fid;
fmd_new->fmd_refcount++; /* list reference */
found = fmd_new;
- OBD_SLAB_FREE_PTR(fmd_new, ll_fmd_cachep);
+ OBD_SLAB_FREE_PTR(fmd_new, tgt_fmd_kmem);
}
}
if (found) {
found->fmd_refcount++; /* caller reference */
}
}
if (found) {
found->fmd_refcount++; /* caller reference */
- found->fmd_expire = now + ofd->ofd_fmd_max_age;
+ found->fmd_expire = ktime_get_seconds() +
+ class_exp2tgt(exp)->lut_fmd_max_age;
+ } else {
+ LCONSOLE_WARN("%s: cannot allocate FMD for "DFID
+ ", timestamps may be out of sync\n",
+ exp->exp_obd->obd_name, PFID(fid));
-
- spin_unlock(&fed->fed_lock);
+ spin_unlock(&ted->ted_fmd_lock);
*/
void ofd_fmd_drop(struct obd_export *exp, const struct lu_fid *fid)
{
*/
void ofd_fmd_drop(struct obd_export *exp, const struct lu_fid *fid)
{
- struct filter_export_data *fed = &exp->exp_filter_data;
- struct ofd_mod_data *found = NULL;
+ struct tg_export_data *ted = &exp->exp_target_data;
+ struct tgt_fmd_data *found = NULL;
- spin_lock(&fed->fed_lock);
+ spin_lock(&ted->ted_fmd_lock);
found = ofd_fmd_find_nolock(exp, fid);
if (found) {
list_del_init(&found->fmd_list);
ofd_fmd_put_nolock(exp, found);
}
found = ofd_fmd_find_nolock(exp, fid);
if (found) {
list_del_init(&found->fmd_list);
ofd_fmd_put_nolock(exp, found);
}
- spin_unlock(&fed->fed_lock);
+ spin_unlock(&ted->ted_fmd_lock);
*/
void ofd_fmd_cleanup(struct obd_export *exp)
{
*/
void ofd_fmd_cleanup(struct obd_export *exp)
{
- struct filter_export_data *fed = &exp->exp_filter_data;
- struct ofd_mod_data *fmd = NULL, *tmp;
+ struct tg_export_data *ted = &exp->exp_target_data;
+ struct tgt_fmd_data *fmd = NULL, *tmp;
- spin_lock(&fed->fed_lock);
- list_for_each_entry_safe(fmd, tmp, &fed->fed_mod_list, fmd_list) {
+ spin_lock(&ted->ted_fmd_lock);
+ list_for_each_entry_safe(fmd, tmp, &ted->ted_fmd_list, fmd_list) {
list_del_init(&fmd->fmd_list);
if (fmd->fmd_refcount > 1) {
list_del_init(&fmd->fmd_list);
if (fmd->fmd_refcount > 1) {
- CDEBUG(D_INFO, "fmd %p still referenced (refcount = %d)\n",
+ CDEBUG(D_INFO,
+ "fmd %p is still referenced (refcount = %d)\n",
fmd, fmd->fmd_refcount);
}
ofd_fmd_put_nolock(exp, fmd);
}
fmd, fmd->fmd_refcount);
}
ofd_fmd_put_nolock(exp, fmd);
}
- spin_unlock(&fed->fed_lock);
+ spin_unlock(&ted->ted_fmd_lock);
- * Initialize FMD subsystem.
+ * Update FMD with the latest request XID.
- * This function is called upon OFD setup and initialize memory to be used
- * by FMD entries.
+ * Save a new setattr/punch XID in FMD if exists.
+ *
+ * \param[in] exp OBD export
+ * \param[in] fid FID of FMD to find
+ * \param[in] xid request XID
+void tgt_fmd_update(struct obd_export *exp, const struct lu_fid *fid, __u64 xid)
- ll_fmd_cachep = kmem_cache_create("ll_fmd_cache",
- sizeof(struct ofd_mod_data),
- 0, 0, NULL);
- if (!ll_fmd_cachep)
- return -ENOMEM;
- else
- return 0;
+ struct tgt_fmd_data *fmd;
+
+ fmd = ofd_fmd_get(exp, fid);
+ if (fmd) {
+ if (fmd->fmd_mactime_xid < xid)
+ fmd->fmd_mactime_xid = xid;
+ ofd_fmd_put(exp, fmd);
+ }
+ * Chech that time can be updated by the request with given XID.
+ *
+ * Check FMD XID if exists to be less than supplied XID
+ *
+ * \param[in] exp OBD export
+ * \param[in] fid FID of FMD to find
+ * \param[in] xid request XID
- * This function is called upon OFD cleanup and destroy memory used
- * by FMD entries.
+ * \retval true if FMD has no greater XID, so time attr can be updated
+bool tgt_fmd_check(struct obd_export *exp, const struct lu_fid *fid, __u64 xid)
- if (ll_fmd_cachep) {
- kmem_cache_destroy(ll_fmd_cachep);
- ll_fmd_cachep = NULL;
+ struct tgt_fmd_data *fmd;
+ bool can_update = true;
+
+ fmd = ofd_fmd_find(exp, fid);
+ if (fmd) {
+ can_update = fmd->fmd_mactime_xid < xid;
+ ofd_fmd_put(exp, fmd);
#define OFD_VALID_FLAGS (LA_TYPE | LA_MODE | LA_SIZE | LA_BLOCKS | \
LA_BLKSIZE | LA_ATIME | LA_MTIME | LA_CTIME)
#define OFD_VALID_FLAGS (LA_TYPE | LA_MODE | LA_SIZE | LA_BLOCKS | \
LA_BLKSIZE | LA_ATIME | LA_MTIME | LA_CTIME)
-/* per-client-per-object persistent state (LRU) */
-struct ofd_mod_data {
- struct list_head fmd_list; /* linked to fed_mod_list */
+/* FMD tracking data */
+struct tgt_fmd_data {
+ struct list_head fmd_list; /* linked to tgt_fmd_list */
struct lu_fid fmd_fid; /* FID being written to */
__u64 fmd_mactime_xid; /* xid highest {m,a,c}time setattr */
time64_t fmd_expire; /* time when the fmd should expire */
int fmd_refcount; /* reference counter - list holds 1 */
};
struct lu_fid fmd_fid; /* FID being written to */
__u64 fmd_mactime_xid; /* xid highest {m,a,c}time setattr */
time64_t fmd_expire; /* time when the fmd should expire */
int fmd_refcount; /* reference counter - list holds 1 */
};
-#define OFD_FMD_MAX_NUM_DEFAULT 128
-#define OFD_FMD_MAX_AGE_DEFAULT (obd_timeout + 10)
-
#define OFD_SOFT_SYNC_LIMIT_DEFAULT 16
/* request stats */
#define OFD_SOFT_SYNC_LIMIT_DEFAULT 16
/* request stats */
/* checksum types supported on this node */
enum cksum_types ofd_cksum_types_supported;
/* checksum types supported on this node */
enum cksum_types ofd_cksum_types_supported;
- /* ofd mod data: ofd_device wide values */
- int ofd_fmd_max_num; /* per ofd ofd_mod_data */
- time64_t ofd_fmd_max_age; /* time to fmd expiry */
-
spinlock_t ofd_flags_lock;
unsigned long ofd_raid_degraded:1,
/* sync journal on writes */
spinlock_t ofd_flags_lock;
unsigned long ofd_raid_degraded:1,
/* sync journal on writes */
-int ofd_fmd_init(void);
-void ofd_fmd_exit(void);
-struct ofd_mod_data *ofd_fmd_find(struct obd_export *exp,
- const struct lu_fid *fid);
-struct ofd_mod_data *ofd_fmd_get(struct obd_export *exp,
- const struct lu_fid *fid);
-void ofd_fmd_put(struct obd_export *exp, struct ofd_mod_data *fmd);
+extern struct kmem_cache *tgt_fmd_kmem;
void ofd_fmd_expire(struct obd_export *exp);
void ofd_fmd_cleanup(struct obd_export *exp);
#ifdef DO_FMD_DROP
void ofd_fmd_expire(struct obd_export *exp);
void ofd_fmd_cleanup(struct obd_export *exp);
#ifdef DO_FMD_DROP
struct niobuf_remote *rnb, int npages,
struct niobuf_local *lnb, int old_rc)
{
struct niobuf_remote *rnb, int npages,
struct niobuf_local *lnb, int old_rc)
{
- struct ofd_thread_info *info = ofd_info(env);
- struct ofd_mod_data *fmd;
- __u64 valid;
- struct ofd_device *ofd = ofd_exp(exp);
- const struct lu_fid *fid = &oa->o_oi.oi_fid;
- int rc = 0;
+ struct ofd_thread_info *info = ofd_info(env);
+ struct ofd_device *ofd = ofd_exp(exp);
+ const struct lu_fid *fid = &oa->o_oi.oi_fid;
+ __u64 valid;
+ int rc = 0;
/* Don't update timestamps if this write is older than a
* setattr which modifies the timestamps. b=10150 */
/* Don't update timestamps if this write is older than a
* setattr which modifies the timestamps. b=10150 */
-
- /* XXX when we start having persistent reservations this needs
- * to be changed to ofd_fmd_get() to create the fmd if it
- * doesn't already exist so we can store the reservation handle
- * there. */
valid = OBD_MD_FLUID | OBD_MD_FLGID | OBD_MD_FLPROJID;
valid = OBD_MD_FLUID | OBD_MD_FLGID | OBD_MD_FLPROJID;
- fmd = ofd_fmd_find(exp, fid);
- if (!fmd || fmd->fmd_mactime_xid < info->fti_xid)
+ if (tgt_fmd_check(exp, fid, info->fti_xid))
valid |= OBD_MD_FLATIME | OBD_MD_FLMTIME |
OBD_MD_FLCTIME;
valid |= OBD_MD_FLATIME | OBD_MD_FLMTIME |
OBD_MD_FLCTIME;
la_from_obdo(&info->fti_attr, oa, valid);
rc = ofd_commitrw_write(env, exp, ofd, fid, &info->fti_attr,
la_from_obdo(&info->fti_attr, oa, valid);
rc = ofd_commitrw_write(env, exp, ofd, fid, &info->fti_attr,
- spin_lock_init(&exp->exp_filter_data.fed_lock);
- INIT_LIST_HEAD(&exp->exp_filter_data.fed_mod_list);
+ spin_lock_init(&exp->exp_target_data.ted_fmd_lock);
+ INIT_LIST_HEAD(&exp->exp_target_data.ted_fmd_list);
atomic_set(&exp->exp_filter_data.fed_soft_sync_count, 0);
spin_lock(&exp->exp_lock);
exp->exp_connecting = 1;
atomic_set(&exp->exp_filter_data.fed_soft_sync_count, 0);
spin_lock(&exp->exp_lock);
exp->exp_connecting = 1;
* interaction with the client is possible
*/
tgt_grant_discard(exp);
* interaction with the client is possible
*/
tgt_grant_discard(exp);
if (exp_connect_flags(exp) & OBD_CONNECT_GRANT)
ofd->ofd_lut.lut_tgd.tgd_tot_granted_clients--;
if (exp_connect_flags(exp) & OBD_CONNECT_GRANT)
ofd->ofd_lut.lut_tgd.tgd_tot_granted_clients--;
if (!(exp->exp_flags & OBD_OPT_FORCE))
tgt_grant_sanity_check(exp->exp_obd, __func__);
if (!(exp->exp_flags & OBD_OPT_FORCE))
tgt_grant_sanity_check(exp->exp_obd, __func__);
- LASSERT(list_empty(&exp->exp_filter_data.fed_mod_list));
int ofd_attr_set(const struct lu_env *env, struct ofd_object *fo,
struct lu_attr *la, struct obdo *oa)
{
int ofd_attr_set(const struct lu_env *env, struct ofd_object *fo,
struct lu_attr *la, struct obdo *oa)
{
- struct ofd_thread_info *info = ofd_info(env);
- struct ofd_device *ofd = ofd_obj2dev(fo);
- struct filter_fid *ff = &info->fti_mds_fid;
- struct thandle *th;
- struct ofd_mod_data *fmd;
- int fl;
- int rc;
- int rc2;
+ struct ofd_thread_info *info = ofd_info(env);
+ struct ofd_device *ofd = ofd_obj2dev(fo);
+ struct filter_fid *ff = &info->fti_mds_fid;
+ struct thandle *th;
+ int fl, rc, rc2;
+
ENTRY;
ofd_write_lock(env, fo);
if (!ofd_object_exists(fo))
GOTO(unlock, rc = -ENOENT);
ENTRY;
ofd_write_lock(env, fo);
if (!ofd_object_exists(fo))
GOTO(unlock, rc = -ENOENT);
- if (la->la_valid & (LA_ATIME | LA_MTIME | LA_CTIME)) {
- fmd = ofd_fmd_get(info->fti_exp, &fo->ofo_header.loh_fid);
- if (fmd && fmd->fmd_mactime_xid < info->fti_xid)
- fmd->fmd_mactime_xid = info->fti_xid;
- ofd_fmd_put(info->fti_exp, fmd);
- }
+ if (la->la_valid & (LA_ATIME | LA_MTIME | LA_CTIME))
+ tgt_fmd_update(info->fti_exp, &fo->ofo_header.loh_fid,
+ info->fti_xid);
/* VBR: version recovery check */
rc = ofd_version_get_check(info, fo);
/* VBR: version recovery check */
rc = ofd_version_get_check(info, fo);
__u64 start, __u64 end, struct lu_attr *la,
struct obdo *oa)
{
__u64 start, __u64 end, struct lu_attr *la,
struct obdo *oa)
{
- struct ofd_thread_info *info = ofd_info(env);
- struct ofd_device *ofd = ofd_obj2dev(fo);
- struct ofd_mod_data *fmd;
- struct dt_object *dob = ofd_object_child(fo);
- struct filter_fid *ff = &info->fti_mds_fid;
- struct thandle *th;
- int fl;
- int rc;
- int rc2;
+ struct ofd_thread_info *info = ofd_info(env);
+ struct ofd_device *ofd = ofd_obj2dev(fo);
+ struct dt_object *dob = ofd_object_child(fo);
+ struct filter_fid *ff = &info->fti_mds_fid;
+ struct thandle *th;
+ int fl, rc, rc2;
LASSERT(end == OBD_OBJECT_EOF);
ofd_write_lock(env, fo);
LASSERT(end == OBD_OBJECT_EOF);
ofd_write_lock(env, fo);
- fmd = ofd_fmd_get(info->fti_exp, &fo->ofo_header.loh_fid);
- if (fmd && fmd->fmd_mactime_xid < info->fti_xid)
- fmd->fmd_mactime_xid = info->fti_xid;
- ofd_fmd_put(info->fti_exp, fmd);
+ if (la->la_valid & (LA_ATIME | LA_MTIME | LA_CTIME))
+ tgt_fmd_update(info->fti_exp, &fo->ofo_header.loh_fid,
+ info->fti_xid);
if (!ofd_object_exists(fo))
GOTO(unlock, rc = -ENOENT);
if (!ofd_object_exists(fo))
GOTO(unlock, rc = -ENOENT);
void tgt_cancel_slc_locks(struct lu_target *tgt, __u64 transno);
void barrier_init(void);
void barrier_fini(void);
void tgt_cancel_slc_locks(struct lu_target *tgt, __u64 transno);
void barrier_init(void);
void barrier_fini(void);
#endif /* _TG_INTERNAL_H */
#endif /* _TG_INTERNAL_H */
dt_txn_callback_add(lut->lut_bottom, &lut->lut_txn_cb);
lut->lut_bottom->dd_lu_dev.ld_site->ls_tgt = lut;
dt_txn_callback_add(lut->lut_bottom, &lut->lut_txn_cb);
lut->lut_bottom->dd_lu_dev.ld_site->ls_tgt = lut;
+ lut->lut_fmd_max_num = LUT_FMD_MAX_NUM_DEFAULT;
+ lut->lut_fmd_max_age = LUT_FMD_MAX_AGE_DEFAULT;
+
+ atomic_set(&lut->lut_sync_count, 0);
+
/* reply_data is supported by MDT targets only for now */
if (strncmp(obd->obd_type->typ_name, LUSTRE_MDT_NAME, 3) != 0)
RETURN(0);
/* reply_data is supported by MDT targets only for now */
if (strncmp(obd->obd_type->typ_name, LUSTRE_MDT_NAME, 3) != 0)
RETURN(0);
if (rc < 0)
GOTO(out, rc);
if (rc < 0)
GOTO(out, rc);
- atomic_set(&lut->lut_sync_count, 0);
-