Skip to content

Commit 65bd5da

Browse files
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>
1 parent 5569b3c commit 65bd5da

1 file changed

Lines changed: 15 additions & 27 deletions

File tree

fs/ntfs3/inode.c

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -992,31 +992,6 @@ static const struct iomap_writeback_ops ntfs_writeback_ops = {
992992
.writeback_submit = iomap_ioend_writeback_submit,
993993
};
994994

995-
static int ntfs_resident_writepage(struct folio *folio,
996-
struct writeback_control *wbc)
997-
{
998-
struct address_space *mapping = folio->mapping;
999-
struct inode *inode = mapping->host;
1000-
struct ntfs_inode *ni = ntfs_i(inode);
1001-
int ret;
1002-
1003-
/* Avoid any operation if inode is bad. */
1004-
if (unlikely(is_bad_ni(ni)))
1005-
return -EINVAL;
1006-
1007-
if (unlikely(ntfs3_forced_shutdown(inode->i_sb)))
1008-
return -EIO;
1009-
1010-
ni_lock(ni);
1011-
ret = attr_data_write_resident(ni, folio);
1012-
ni_unlock(ni);
1013-
1014-
if (ret != E_NTFS_NONRESIDENT)
1015-
folio_unlock(folio);
1016-
mapping_set_error(mapping, ret);
1017-
return ret;
1018-
}
1019-
1020995
static int ntfs_writepages(struct address_space *mapping,
1021996
struct writeback_control *wbc)
1022997
{
@@ -1038,9 +1013,22 @@ static int ntfs_writepages(struct address_space *mapping,
10381013

10391014
if (is_resident(ni)) {
10401015
struct folio *folio = NULL;
1016+
err = 0;
1017+
1018+
while ((folio = writeback_iter(mapping, wbc, folio, &err))) {
1019+
int err2;
1020+
1021+
ni_lock(ni);
1022+
err2 = attr_data_write_resident(ni, folio);
1023+
ni_unlock(ni);
10411024

1042-
while ((folio = writeback_iter(mapping, wbc, folio, &err)))
1043-
err = ntfs_resident_writepage(folio, wbc);
1025+
folio_unlock(folio);
1026+
if (err2) {
1027+
mapping_set_error(mapping, err2);
1028+
if (!err)
1029+
err = err2;
1030+
}
1031+
}
10441032

10451033
return err;
10461034
}

0 commit comments

Comments
 (0)