fix incorrect data and allocation sizes in index and inode FILE_NAME

attributes for some resident unnamed $DATA attributes and for which CHKDSK
reported minor inconsistencies.
master
szaka 2008-03-08 12:04:25 +00:00
parent 4ce572b79d
commit df0177485b
2 changed files with 6 additions and 0 deletions

View File

@ -2726,6 +2726,10 @@ int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type,
goto put_err_out;
}
}
if (type == AT_DATA && name == AT_UNNAMED) {
ni->data_size = size;
ni->allocated_size = (size + 7) & ~7;
}
ntfs_inode_mark_dirty(ni);
ntfs_attr_put_search_ctx(ctx);
return offset;

View File

@ -1203,6 +1203,8 @@ static ntfs_inode *__ntfs_create(ntfs_inode *dir_ni,
fn->last_data_change_time = utc2ntfs(ni->last_data_change_time);
fn->last_mft_change_time = utc2ntfs(ni->last_mft_change_time);
fn->last_access_time = utc2ntfs(ni->last_access_time);
fn->data_size = cpu_to_sle64(ni->data_size);
fn->allocated_size = cpu_to_sle64(ni->allocated_size);
memcpy(fn->file_name, name, name_len * sizeof(ntfschar));
/* Add FILE_NAME attribute to inode. */
if (ntfs_attr_add(ni, AT_FILE_NAME, AT_UNNAMED, 0, (u8*)fn, fn_len)) {