diff options
author | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2022-06-30 18:14:43 +0200 |
---|---|---|
committer | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2022-08-03 17:25:06 +0200 |
commit | 071100ea0e6c353258f322cb2f8dde9be62d6808 (patch) | |
tree | 32e11122178d72eb2f1acad76bc424ea47841844 /fs/ntfs3/fsntfs.c | |
parent | fs/ntfs3: Remove unused mi_mark_free (diff) | |
download | linux-071100ea0e6c353258f322cb2f8dde9be62d6808.tar.xz linux-071100ea0e6c353258f322cb2f8dde9be62d6808.zip |
fs/ntfs3: Add new argument is_mft to ntfs_mark_rec_free
This argument helps in avoiding double locking
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Diffstat (limited to 'fs/ntfs3/fsntfs.c')
-rw-r--r-- | fs/ntfs3/fsntfs.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c index 938acb246b58..fa4ca8b9b499 100644 --- a/fs/ntfs3/fsntfs.c +++ b/fs/ntfs3/fsntfs.c @@ -703,12 +703,14 @@ out: /* * ntfs_mark_rec_free - Mark record as free. + * is_mft - true if we are changing MFT */ -void ntfs_mark_rec_free(struct ntfs_sb_info *sbi, CLST rno) +void ntfs_mark_rec_free(struct ntfs_sb_info *sbi, CLST rno, bool is_mft) { struct wnd_bitmap *wnd = &sbi->mft.bitmap; - down_write_nested(&wnd->rw_lock, BITMAP_MUTEX_MFT); + if (!is_mft) + down_write_nested(&wnd->rw_lock, BITMAP_MUTEX_MFT); if (rno >= wnd->nbits) goto out; @@ -727,7 +729,8 @@ void ntfs_mark_rec_free(struct ntfs_sb_info *sbi, CLST rno) sbi->mft.next_free = rno; out: - up_write(&wnd->rw_lock); + if (!is_mft) + up_write(&wnd->rw_lock); } /* |