mirror of
https://git.code.sf.net/p/ntfs-3g/ntfs-3g.git
synced 2024-12-04 23:43:35 +08:00
fixed compression when a runlist relocation is needed
This commit is contained in:
parent
4d73c7c4f1
commit
207318b504
@ -1528,18 +1528,35 @@ static int borrow_from_hole(ntfs_attr *na, runlist_element **prl,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
runlist_element *orl = na->rl;
|
runlist_element *orl = na->rl;
|
||||||
|
s64 olcn = (*prl)->lcn;
|
||||||
/*
|
/*
|
||||||
* Map the full runlist (needed to compute the
|
* Map the full runlist (needed to compute the
|
||||||
* compressed size), unless the runlist has not
|
* compressed size), unless the runlist has not
|
||||||
* yet been created (data just made non-resident)
|
* yet been created (data just made non-resident)
|
||||||
*/
|
*/
|
||||||
|
irl = *prl - na->rl;
|
||||||
if (!NAttrBeingNonResident(na)
|
if (!NAttrBeingNonResident(na)
|
||||||
&& ntfs_attr_map_whole_runlist(na)) {
|
&& ntfs_attr_map_whole_runlist(na)) {
|
||||||
*prl = (runlist_element*)NULL;
|
*prl = (runlist_element*)NULL;
|
||||||
} else {
|
} else {
|
||||||
if (na->rl != orl) {
|
/*
|
||||||
/* hope this cannot happen */
|
* Mapping the runlist may cause its relocation,
|
||||||
ntfs_log_error("Unexpected runlist relocation\n");
|
* and relocation may be at the same place with
|
||||||
|
* relocated contents.
|
||||||
|
* Have to find the current run again when this
|
||||||
|
* happens.
|
||||||
|
*/
|
||||||
|
if ((na->rl != orl) || ((*prl)->lcn != olcn)) {
|
||||||
|
zrl = &na->rl[irl];
|
||||||
|
while (zrl->length && (zrl->lcn != olcn))
|
||||||
|
zrl++;
|
||||||
|
*prl = zrl;
|
||||||
|
}
|
||||||
|
if (!(*prl)->length) {
|
||||||
|
ntfs_log_error("Mapped run not found,"
|
||||||
|
" inode %lld lcn 0x%llx\n",
|
||||||
|
(long long)na->ni->mft_no,
|
||||||
|
(long long)olcn);
|
||||||
*prl = (runlist_element*)NULL;
|
*prl = (runlist_element*)NULL;
|
||||||
} else {
|
} else {
|
||||||
*prl = ntfs_rl_extend(na,*prl,2);
|
*prl = ntfs_rl_extend(na,*prl,2);
|
||||||
|
Loading…
Reference in New Issue
Block a user