X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fmdt%2Fmdt_hsm_cdt_actions.c;h=cd2c2478eb9b59e77d7628a8a0a97ee9a04c1eb3;hb=7b2cb54858daa60d560fd6374c4ecba552a10d27;hp=32ea69f75d72bbf3e99cfb2f46d6080fdf142793;hpb=a861f8deb4d064a5835c3ba81a756aace625b88c;p=fs%2Flustre-release.git diff --git a/lustre/mdt/mdt_hsm_cdt_actions.c b/lustre/mdt/mdt_hsm_cdt_actions.c index 32ea69f..cd2c247 100644 --- a/lustre/mdt/mdt_hsm_cdt_actions.c +++ b/lustre/mdt/mdt_hsm_cdt_actions.c @@ -23,7 +23,7 @@ * (C) Copyright 2012 Commissariat a l'energie atomique et aux energies * alternatives * - * Copyright (c) 2013, 2016, Intel Corporation. + * Copyright (c) 2013, 2017, Intel Corporation. */ /* * lustre/mdt/mdt_hsm_cdt_actions.c @@ -175,7 +175,7 @@ void dump_llog_agent_req_rec(const char *prefix, sz = larr->arr_hai.hai_len - sizeof(larr->arr_hai); CDEBUG(D_HSM, "%slrh=[type=%X len=%d idx=%d] fid="DFID " dfid="DFID - " compound/cookie=%#llx/%#llx" + " cookie=%#llx" " status=%s action=%s archive#=%d flags=%#llx" " create=%llu change=%llu" " extent=%#llx-%#llx gid=%#llx datalen=%d" @@ -185,7 +185,7 @@ void dump_llog_agent_req_rec(const char *prefix, larr->arr_hdr.lrh_len, larr->arr_hdr.lrh_index, PFID(&larr->arr_hai.hai_fid), PFID(&larr->arr_hai.hai_dfid), - larr->arr_compound_id, larr->arr_hai.hai_cookie, + larr->arr_hai.hai_cookie, agent_req_status2name(larr->arr_status), hsm_copytool_action2name(larr->arr_hai.hai_action), larr->arr_archive_id, @@ -250,16 +250,14 @@ int cdt_llog_process(const struct lu_env *env, struct mdt_device *mdt, * add an entry in agent llog * \param env [IN] environment * \param mdt [IN] PDT device - * \param compound_id [IN] global id associated with the record * \param archive_id [IN] backend archive number * \param hai [IN] record to register * \retval 0 success * \retval -ve failure */ -int mdt_agent_record_add(const struct lu_env *env, - struct mdt_device *mdt, - __u64 compound_id, __u32 archive_id, - __u64 flags, struct hsm_action_item *hai) +int mdt_agent_record_add(const struct lu_env *env, struct mdt_device *mdt, + __u32 archive_id, __u64 flags, + struct hsm_action_item *hai) { struct obd_device *obd = mdt2obd_dev(mdt); struct coordinator *cdt = &mdt->mdt_coordinator; @@ -276,7 +274,6 @@ int mdt_agent_record_add(const struct lu_env *env, larr->arr_hdr.lrh_len = sz; larr->arr_hdr.lrh_type = HSM_AGENT_REC; larr->arr_status = ARS_WAITING; - larr->arr_compound_id = compound_id; larr->arr_archive_id = archive_id; larr->arr_flags = flags; larr->arr_req_create = ktime_get_real_seconds(); @@ -292,12 +289,10 @@ int mdt_agent_record_add(const struct lu_env *env, /* in case of cancel request, the cookie is already set to the * value of the request cookie to be cancelled * so we do not change it */ - if (hai->hai_action == HSMA_CANCEL) { + if (hai->hai_action == HSMA_CANCEL) larr->arr_hai.hai_cookie = hai->hai_cookie; - } else { - cdt->cdt_last_cookie++; - larr->arr_hai.hai_cookie = cdt->cdt_last_cookie; - } + else + larr->arr_hai.hai_cookie = cdt->cdt_last_cookie++; rc = llog_cat_add(env, lctxt->loc_handle, &larr->arr_hdr, NULL); if (rc > 0) @@ -485,7 +480,7 @@ struct agent_action_iterator { * seq_file method called to start access to /proc file * get llog context + llog handle */ -static void *mdt_hsm_actions_proc_start(struct seq_file *s, loff_t *pos) +static void *mdt_hsm_actions_debugfs_start(struct seq_file *s, loff_t *pos) { struct agent_action_iterator *aai = s->private; ENTRY; @@ -516,7 +511,7 @@ static void *mdt_hsm_actions_proc_start(struct seq_file *s, loff_t *pos) RETURN(aai); } -static void *mdt_hsm_actions_proc_next(struct seq_file *s, void *v, +static void *mdt_hsm_actions_debugfs_next(struct seq_file *s, void *v, loff_t *pos) { RETURN(NULL); @@ -559,7 +554,7 @@ static int hsm_actions_show_cb(const struct lu_env *env, llh->lgh_hdr->llh_cat_idx, hdr->lrh_index, PFID(&larr->arr_hai.hai_fid), PFID(&larr->arr_hai.hai_dfid), - larr->arr_compound_id, larr->arr_hai.hai_cookie, + 0ULL /* compound_id */, larr->arr_hai.hai_cookie, hsm_copytool_action2name(larr->arr_hai.hai_action), larr->arr_archive_id, larr->arr_flags, @@ -576,11 +571,11 @@ static int hsm_actions_show_cb(const struct lu_env *env, } /** - * mdt_hsm_actions_proc_show() is called at for each seq record + * mdt_hsm_actions_debugfs_show() is called at for each seq record * process the llog, with a cb which fill the file_seq buffer * to be faster, one show will fill multiple records */ -static int mdt_hsm_actions_proc_show(struct seq_file *s, void *v) +static int mdt_hsm_actions_debugfs_show(struct seq_file *s, void *v) { struct agent_action_iterator *aai = s->private; struct coordinator *cdt = &aai->aai_mdt->mdt_coordinator; @@ -611,7 +606,7 @@ static int mdt_hsm_actions_proc_show(struct seq_file *s, void *v) * seq_file method called to stop access to /proc file * clean + put llog context */ -static void mdt_hsm_actions_proc_stop(struct seq_file *s, void *v) +static void mdt_hsm_actions_debugfs_stop(struct seq_file *s, void *v) { struct agent_action_iterator *aai = s->private; ENTRY; @@ -626,14 +621,14 @@ static void mdt_hsm_actions_proc_stop(struct seq_file *s, void *v) return; } -static const struct seq_operations mdt_hsm_actions_proc_ops = { - .start = mdt_hsm_actions_proc_start, - .next = mdt_hsm_actions_proc_next, - .show = mdt_hsm_actions_proc_show, - .stop = mdt_hsm_actions_proc_stop, +static const struct seq_operations mdt_hsm_actions_debugfs_ops = { + .start = mdt_hsm_actions_debugfs_start, + .next = mdt_hsm_actions_debugfs_next, + .show = mdt_hsm_actions_debugfs_show, + .stop = mdt_hsm_actions_debugfs_stop, }; -static int lprocfs_open_hsm_actions(struct inode *inode, struct file *file) +static int ldebugfs_open_hsm_actions(struct inode *inode, struct file *file) { struct agent_action_iterator *aai; struct seq_file *s; @@ -641,7 +636,7 @@ static int lprocfs_open_hsm_actions(struct inode *inode, struct file *file) struct mdt_device *mdt; ENTRY; - rc = seq_open(file, &mdt_hsm_actions_proc_ops); + rc = seq_open(file, &mdt_hsm_actions_debugfs_ops); if (rc) RETURN(rc); @@ -654,10 +649,11 @@ static int lprocfs_open_hsm_actions(struct inode *inode, struct file *file) if (rc) GOTO(err, rc); - /* mdt is saved in proc_dir_entry->data by - * mdt_coordinator_procfs_init() calling lprocfs_register() + /* mdt is saved in seq_file->data by + * mdt_coordinator_tunables_init() calling + * debugfs_register() */ - mdt = (struct mdt_device *)PDE_DATA(inode); + mdt = inode->i_private; aai->aai_mdt = mdt; s = file->private_data; s->private = aai; @@ -665,7 +661,7 @@ static int lprocfs_open_hsm_actions(struct inode *inode, struct file *file) GOTO(out, rc = 0); err: - lprocfs_seq_release(inode, file); + seq_release(inode, file); if (aai && aai->aai_env.le_ses) OBD_FREE_PTR(aai->aai_env.le_ses); if (aai) @@ -675,10 +671,10 @@ out: } /** - * lprocfs_release_hsm_actions() is called at end of /proc access. + * ldebugfs_release_hsm_actions() is called at end of /proc access. * It frees allocated resources and calls cleanup lprocfs methods. */ -static int lprocfs_release_hsm_actions(struct inode *inode, struct file *file) +static int ldebugfs_release_hsm_actions(struct inode *inode, struct file *file) { struct seq_file *seq = file->private_data; struct agent_action_iterator *aai = seq->private; @@ -688,14 +684,14 @@ static int lprocfs_release_hsm_actions(struct inode *inode, struct file *file) OBD_FREE_PTR(aai); } - return lprocfs_seq_release(inode, file); + return seq_release(inode, file); } /* Methods to access HSM action list LLOG through /proc */ const struct file_operations mdt_hsm_actions_fops = { .owner = THIS_MODULE, - .open = lprocfs_open_hsm_actions, + .open = ldebugfs_open_hsm_actions, .read = seq_read, .llseek = seq_lseek, - .release = lprocfs_release_hsm_actions, + .release = ldebugfs_release_hsm_actions, };