diff options
| author | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2026-05-22 14:55:38 +0200 |
|---|---|---|
| committer | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2026-05-28 15:42:13 +0200 |
| commit | 5e5f38bbca31c11cd5eef4632b2a1139088dc9db (patch) | |
| tree | 685c761a1f980d8ba00ca479ba37b15c3a258b97 /fs | |
| parent | b759e6b60ebf26c68c399db49cb2885c8cf901b3 (diff) | |
| download | linux-next-history-5e5f38bbca31c11cd5eef4632b2a1139088dc9db.tar.gz | |
fs/ntfs3: fold resident writeback into writepages loop
Remove the separate ntfs_resident_writepage() helper and handle resident
writeback directly from ntfs_writepages(). This simplifies the resident
writeback path and keeps the folio handling local to ntfs_writepages().
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/ntfs3/inode.c | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index 356fc94c5a180..9a75c2d832cab 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -992,31 +992,6 @@ static const struct iomap_writeback_ops ntfs_writeback_ops = { .writeback_submit = iomap_ioend_writeback_submit, }; -static int ntfs_resident_writepage(struct folio *folio, - struct writeback_control *wbc) -{ - struct address_space *mapping = folio->mapping; - struct inode *inode = mapping->host; - struct ntfs_inode *ni = ntfs_i(inode); - int ret; - - /* Avoid any operation if inode is bad. */ - if (unlikely(is_bad_ni(ni))) - return -EINVAL; - - if (unlikely(ntfs3_forced_shutdown(inode->i_sb))) - return -EIO; - - ni_lock(ni); - ret = attr_data_write_resident(ni, folio); - ni_unlock(ni); - - if (ret != E_NTFS_NONRESIDENT) - folio_unlock(folio); - mapping_set_error(mapping, ret); - return ret; -} - static int ntfs_writepages(struct address_space *mapping, struct writeback_control *wbc) { @@ -1038,9 +1013,22 @@ static int ntfs_writepages(struct address_space *mapping, if (is_resident(ni)) { struct folio *folio = NULL; + err = 0; + + while ((folio = writeback_iter(mapping, wbc, folio, &err))) { + int err2; + + ni_lock(ni); + err2 = attr_data_write_resident(ni, folio); + ni_unlock(ni); - while ((folio = writeback_iter(mapping, wbc, folio, &err))) - err = ntfs_resident_writepage(folio, wbc); + folio_unlock(folio); + if (err2) { + mapping_set_error(mapping, err2); + if (!err) + err = err2; + } + } return err; } |
