summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
7b654fc)
It is possible to insert identical HSM requests in the HSM action
list. The following command
lfs hsm-archive foo foo foo foo
results in 4 new archive requests in the "actions" list for the same
file.
Identify such requests and suppress the duplicates.
Signed-off-by: frank zago <fzago@cray.com>
Change-Id: If83d2855948578b94babca96dc72c33f96ae4f71
Reviewed-on: http://review.whamcloud.com/19635
Tested-by: Jenkins
Reviewed-by: jacques-Charles Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
+/* Return true if a FID is present in an action list. */
+static bool is_fid_in_hal(struct hsm_action_list *hal, const lustre_fid *fid)
+{
+ struct hsm_action_item *hai;
+ int i;
+
+ for (hai = hai_first(hal), i = 0;
+ i < hal->hal_count;
+ i++, hai = hai_next(hai)) {
+ if (lu_fid_eq(&hai->hai_fid, fid))
+ return true;
+ }
+
+ return false;
+}
+
/**
* Process the HSM actions described in a struct hsm_user_request.
*
/**
* Process the HSM actions described in a struct hsm_user_request.
*
obd_uuid2fsname(hal->hal_fsname, mdt_obd_name(info->mti_mdt),
MTI_NAME_MAXLEN);
obd_uuid2fsname(hal->hal_fsname, mdt_obd_name(info->mti_mdt),
MTI_NAME_MAXLEN);
- hal->hal_count = hr->hr_itemcount;
hai = hai_first(hal);
for (i = 0; i < hr->hr_itemcount; i++, hai = hai_next(hai)) {
hai = hai_first(hal);
for (i = 0; i < hr->hr_itemcount; i++, hai = hai_next(hai)) {
+ /* Get rid of duplicate entries. Otherwise we get
+ * duplicated work in the llog. */
+ if (is_fid_in_hal(hal, &hui[i].hui_fid))
+ continue;
+
hai->hai_action = action;
hai->hai_cookie = 0;
hai->hai_gid = 0;
hai->hai_action = action;
hai->hai_cookie = 0;
hai->hai_gid = 0;
hai->hai_extent = hui[i].hui_extent;
memcpy(hai->hai_data, data, hr->hr_data_len);
hai->hai_len = sizeof(*hai) + hr->hr_data_len;
hai->hai_extent = hui[i].hui_extent;
memcpy(hai->hai_data, data, hr->hr_data_len);
hai->hai_len = sizeof(*hai) + hr->hr_data_len;
}
rc = mdt_hsm_add_actions(info, hal, &compound_id);
}
rc = mdt_hsm_add_actions(info, hal, &compound_id);