comp[idx].lrc_mirror_id = mirror_id;
comp[idx].lrc_start = start;
comp[idx].lrc_end = end;
+ comp[idx].lrc_synced = true;
idx++;
if (idx >= comp_size) {
buf + pos2 - pos,
to_write2, pos2);
if (written < 0) {
- /**
- * this component is not written successfully,
- * mark it using its lrc_synced, it is supposed
- * to be false before getting here.
- *
- * And before this function returns, all
- * elements of comp_array will reverse their
- * lrc_synced flag to reflect their true
- * meanings.
- */
- comp_array[i].lrc_synced = true;
+ comp_array[i].lrc_synced = false;
llapi_error(LLAPI_MSG_ERROR, written,
"component %u not synced",
comp_array[i].lrc_id);
/**
* no fatal error happens, each lrc_synced tells whether the component
- * has been resync successfully (note: we'd reverse the value to
- * reflect its true meaning.
+ * has been resync successfully.
*/
for (i = 0; i < comp_size; i++) {
struct llapi_resync_comp *comp = comp_array + i;
- comp->lrc_synced = !comp->lrc_synced;
-
if (!comp->lrc_synced)
continue;
if (pos < comp->lrc_start || pos >= comp->lrc_end)
continue;
if (pos < st.st_size) {
- llapi_mirror_punch(fd, comp->lrc_mirror_id, pos,
- comp_array[i].lrc_end - pos);
- continue;
+ rc = llapi_mirror_punch(fd, comp->lrc_mirror_id, pos,
+ comp->lrc_end - pos);
+ } else {
+ rc = llapi_mirror_truncate(fd, comp->lrc_mirror_id,
+ pos);
}
- rc = llapi_mirror_truncate(fd, comp->lrc_mirror_id, pos);
/* Ignore truncate error on encrypted file without the
* key if tried on LUSTRE_ENCRYPTION_UNIT_SIZE boundary.
*/
- if (rc < 0 && (rc != -ENOKEY ||
- pos & ~LUSTRE_ENCRYPTION_MASK))
+ if (rc < 0 && (rc != -ENOKEY || pos & ~LUSTRE_ENCRYPTION_MASK))
comp->lrc_synced = false;
}