diff options
author | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2022-10-11 20:19:36 +0300 |
---|---|---|
committer | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2022-11-14 19:50:48 +0300 |
commit | ec5fc72013762500867c9cef96fed89dc7161832 (patch) | |
tree | 1a7b889fe1a3d168eb1453666f5755274a429f11 /fs/ntfs3/run.c | |
parent | 60ce8dfde03558bfc290cd915c60fa243ba2ae84 (diff) | |
download | linux-ec5fc72013762500867c9cef96fed89dc7161832.tar.xz |
fs/ntfs3: Improve checking of bad clusters
Added new function wnd_set_used_safe.
Load $BadClus before $AttrDef instead of before $Bitmap.
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Diffstat (limited to 'fs/ntfs3/run.c')
-rw-r--r-- | fs/ntfs3/run.c | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/fs/ntfs3/run.c b/fs/ntfs3/run.c index 12d8682f33b5..a5af71cd8d14 100644 --- a/fs/ntfs3/run.c +++ b/fs/ntfs3/run.c @@ -1096,25 +1096,8 @@ int run_unpack_ex(struct runs_tree *run, struct ntfs_sb_info *sbi, CLST ino, if (down_write_trylock(&wnd->rw_lock)) { /* Mark all zero bits as used in range [lcn, lcn+len). */ - CLST i, lcn_f = 0, len_f = 0; - - err = 0; - for (i = 0; i < len; i++) { - if (wnd_is_free(wnd, lcn + i, 1)) { - if (!len_f) - lcn_f = lcn + i; - len_f += 1; - } else if (len_f) { - err = wnd_set_used(wnd, lcn_f, len_f); - len_f = 0; - if (err) - break; - } - } - - if (len_f) - err = wnd_set_used(wnd, lcn_f, len_f); - + size_t done; + err = wnd_set_used_safe(wnd, lcn, len, &done); up_write(&wnd->rw_lock); if (err) return err; |