#include <linux/module.h>
#include <linux/kthread.h>
#include <obd_class.h>
-#include <lustre_ioctl.h>
+#include <uapi/linux/lustre/lustre_ioctl.h>
#include <lustre_mds.h>
#include <obd_support.h>
#include <lu_object.h>
-#include <lustre_param.h>
+#include <uapi/linux/lustre/lustre_param.h>
#include <lustre_fid.h>
#include <lustre_nodemap.h>
#include <lustre_barrier.h>
RETURN(rc);
mdd->mdd_atime_diff = MAX_ATIME_DIFF;
- /* sync permission changes */
- mdd->mdd_sync_permission = 1;
+ /* sync permission changes */
+ mdd->mdd_sync_permission = 1;
+ /* enable changelog garbage collection */
+ mdd->mdd_changelog_gc = 1;
+ /* with a significant amount of idle time */
+ mdd->mdd_changelog_max_idle_time = CHLOG_MAX_IDLE_TIME;
+ /* or a significant amount of late indexes */
+ mdd->mdd_changelog_max_idle_indexes = CHLOG_MAX_IDLE_INDEXES;
+ /* with a reasonable interval between each check */
+ mdd->mdd_changelog_min_gc_interval = CHLOG_MIN_GC_INTERVAL;
+ /* with a very few number of free entries */
+ mdd->mdd_changelog_min_free_cat_entries = CHLOG_MIN_FREE_CAT_ENTRIES;
dt_conf_get(env, mdd->mdd_child, &mdd->mdd_dt_conf);
mdd->mdd_cl.mc_index = 0;
spin_lock_init(&mdd->mdd_cl.mc_lock);
- mdd->mdd_cl.mc_starttime = cfs_time_current_64();
+ mdd->mdd_cl.mc_starttime = ktime_get();
spin_lock_init(&mdd->mdd_cl.mc_user_lock);
mdd->mdd_cl.mc_lastuser = 0;
/* Some records were purged, so reset repeat-access time (so we
record new mtime update records, so users can see a file has been
changed since the last purge) */
- mdd->mdd_cl.mc_starttime = cfs_time_current_64();
+ mdd->mdd_cl.mc_starttime = ktime_get();
rc = llog_cancel(env, ctxt, (struct llog_cookie *)&endrec, 0);
out:
ENTRY;
if (mdd->mdd_cl.mc_mask & (1 << CL_MARK)) {
- mdd->mdd_cl.mc_starttime = cfs_time_current_64();
+ mdd->mdd_cl.mc_starttime = ktime_get();
RETURN(0);
}
llog_ctxt_put(ctxt);
/* assume on or off event; reset repeat-access time */
- mdd->mdd_cl.mc_starttime = cfs_time_current_64();
+ mdd->mdd_cl.mc_starttime = ktime_get();
RETURN(rc);
}
RETURN(rc);
}
-static int mdd_maxeasize_get(const struct lu_env *env, struct md_device *m,
- int *easize)
+static const struct dt_device_param *mdd_dtconf_get(const struct lu_env *env,
+ struct md_device *m)
{
struct mdd_device *mdd = lu2mdd_dev(&m->md_lu_dev);
- ENTRY;
-
- *easize = mdd->mdd_dt_conf.ddp_max_ea_size;
- RETURN(0);
+ return &mdd->mdd_dt_conf;
}
static int mdd_llog_ctxt_get(const struct lu_env *env, struct md_device *m,
}
*id = rec->cur_id = ++mdd->mdd_cl.mc_lastuser;
rec->cur_endrec = mdd->mdd_cl.mc_index;
+
+ rec->cur_time = (__u32)get_seconds();
+ if (OBD_FAIL_CHECK(OBD_FAIL_TIME_IN_CHLOG_USER))
+ rec->cur_time = 0;
+
spin_unlock(&mdd->mdd_cl.mc_user_lock);
rc = llog_cat_add(env, ctxt->loc_handle, &rec->cur_hdr, NULL);
RETURN(rc);
}
-static int mdd_changelog_user_purge(const struct lu_env *env,
- struct mdd_device *mdd, __u32 id)
+int mdd_changelog_user_purge(const struct lu_env *env,
+ struct mdd_device *mdd, __u32 id)
{
struct mdd_changelog_user_purge mcup = {
.mcup_id = id,
* We now know the record to flush.
*/
rec->cur_endrec = mcuc->mcuc_endrec;
+
+ rec->cur_time = (__u32)get_seconds();
+ if (OBD_FAIL_CHECK(OBD_FAIL_TIME_IN_CHLOG_USER))
+ rec->cur_time = 0;
+
mcuc->mcuc_flush = true;
CDEBUG(D_IOCTL, "Rewriting changelog user %u endrec to %llu\n",
barrier_exit(mdd->mdd_bottom);
RETURN(rc);
}
- case OBD_IOC_GET_MNTOPT: {
- mntopt_t *mntopts = (mntopt_t *)karg;
- *mntopts = mdd->mdd_dt_conf.ddp_mntopts;
- RETURN(0);
- }
case OBD_IOC_START_LFSCK: {
rc = lfsck_start(env, mdd->mdd_bottom,
(struct lfsck_start_param *)karg);
.mdo_root_get = mdd_root_get,
.mdo_llog_ctxt_get = mdd_llog_ctxt_get,
.mdo_iocontrol = mdd_iocontrol,
- .mdo_maxeasize_get = mdd_maxeasize_get,
+ .mdo_dtconf_get = mdd_dtconf_get,
};
static struct lu_device_type_operations mdd_device_type_ops = {
LU_KEY_INIT(mdd, struct mdd_thread_info);
static void mdd_key_fini(const struct lu_context *ctx,
- struct lu_context_key *key, void *data)
+ struct lu_context_key *key, void *data)
{
- struct mdd_thread_info *info = data;
+ struct mdd_thread_info *info = data;
lu_buf_free(&info->mti_big_buf);
lu_buf_free(&info->mti_link_buf);
+ lu_buf_free(&info->mti_xattr_buf);
- OBD_FREE_PTR(info);
+ OBD_FREE_PTR(info);
}
/* context key: mdd_thread_key */