mirror of
https://git.proxmox.com/git/mirror_ubuntu-kernels.git
synced 2025-11-25 20:25:16 +00:00
fs/ntfs3: Fix multithreaded stress test
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
This commit is contained in:
parent
865e7a7700
commit
a8b0c9fc3a
@ -886,7 +886,7 @@ int attr_data_get_block(struct ntfs_inode *ni, CLST vcn, CLST clen, CLST *lcn,
|
|||||||
struct runs_tree *run = &ni->file.run;
|
struct runs_tree *run = &ni->file.run;
|
||||||
struct ntfs_sb_info *sbi;
|
struct ntfs_sb_info *sbi;
|
||||||
u8 cluster_bits;
|
u8 cluster_bits;
|
||||||
struct ATTRIB *attr = NULL, *attr_b;
|
struct ATTRIB *attr, *attr_b;
|
||||||
struct ATTR_LIST_ENTRY *le, *le_b;
|
struct ATTR_LIST_ENTRY *le, *le_b;
|
||||||
struct mft_inode *mi, *mi_b;
|
struct mft_inode *mi, *mi_b;
|
||||||
CLST hint, svcn, to_alloc, evcn1, next_svcn, asize, end, vcn0, alen;
|
CLST hint, svcn, to_alloc, evcn1, next_svcn, asize, end, vcn0, alen;
|
||||||
@ -904,12 +904,8 @@ int attr_data_get_block(struct ntfs_inode *ni, CLST vcn, CLST clen, CLST *lcn,
|
|||||||
*len = 0;
|
*len = 0;
|
||||||
up_read(&ni->file.run_lock);
|
up_read(&ni->file.run_lock);
|
||||||
|
|
||||||
if (*len) {
|
if (*len && (*lcn != SPARSE_LCN || !new))
|
||||||
if (*lcn != SPARSE_LCN || !new)
|
|
||||||
return 0; /* Fast normal way without allocation. */
|
return 0; /* Fast normal way without allocation. */
|
||||||
else if (clen > *len)
|
|
||||||
clen = *len;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* No cluster in cache or we need to allocate cluster in hole. */
|
/* No cluster in cache or we need to allocate cluster in hole. */
|
||||||
sbi = ni->mi.sbi;
|
sbi = ni->mi.sbi;
|
||||||
@ -918,6 +914,17 @@ int attr_data_get_block(struct ntfs_inode *ni, CLST vcn, CLST clen, CLST *lcn,
|
|||||||
ni_lock(ni);
|
ni_lock(ni);
|
||||||
down_write(&ni->file.run_lock);
|
down_write(&ni->file.run_lock);
|
||||||
|
|
||||||
|
/* Repeat the code above (under write lock). */
|
||||||
|
if (!run_lookup_entry(run, vcn, lcn, len, NULL))
|
||||||
|
*len = 0;
|
||||||
|
|
||||||
|
if (*len) {
|
||||||
|
if (*lcn != SPARSE_LCN || !new)
|
||||||
|
goto out; /* normal way without allocation. */
|
||||||
|
if (clen > *len)
|
||||||
|
clen = *len;
|
||||||
|
}
|
||||||
|
|
||||||
le_b = NULL;
|
le_b = NULL;
|
||||||
attr_b = ni_find_attr(ni, NULL, &le_b, ATTR_DATA, NULL, 0, NULL, &mi_b);
|
attr_b = ni_find_attr(ni, NULL, &le_b, ATTR_DATA, NULL, 0, NULL, &mi_b);
|
||||||
if (!attr_b) {
|
if (!attr_b) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user