Skip to content

Commit

Permalink
fs/ntfs3: Switch to folio to release resources
Browse files Browse the repository at this point in the history
As part of the process of switching from page to folio.

Signed-off-by: Konstantin Komarov <[email protected]>
  • Loading branch information
aalexandrovich committed Nov 1, 2024
1 parent db1d2b4 commit 678c190
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions fs/ntfs3/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,7 @@ static ssize_t ntfs_compress_write(struct kiocb *iocb, struct iov_iter *from)
u64 frame_vbo;
pgoff_t index;
bool frame_uptodate;
struct folio *folio;

if (frame_size < PAGE_SIZE) {
/*
Expand Down Expand Up @@ -1043,8 +1044,9 @@ static ssize_t ntfs_compress_write(struct kiocb *iocb, struct iov_iter *from)
if (err) {
for (ip = 0; ip < pages_per_frame; ip++) {
page = pages[ip];
unlock_page(page);
put_page(page);
folio = page_folio(page);
folio_unlock(folio);
folio_put(folio);
}
goto out;
}
Expand All @@ -1054,9 +1056,10 @@ static ssize_t ntfs_compress_write(struct kiocb *iocb, struct iov_iter *from)
off = offset_in_page(valid);
for (; ip < pages_per_frame; ip++, off = 0) {
page = pages[ip];
folio = page_folio(page);
zero_user_segment(page, off, PAGE_SIZE);
flush_dcache_page(page);
SetPageUptodate(page);
folio_mark_uptodate(folio);
}

ni_lock(ni);
Expand All @@ -1065,9 +1068,10 @@ static ssize_t ntfs_compress_write(struct kiocb *iocb, struct iov_iter *from)

for (ip = 0; ip < pages_per_frame; ip++) {
page = pages[ip];
SetPageUptodate(page);
unlock_page(page);
put_page(page);
folio = page_folio(page);
folio_mark_uptodate(folio);
folio_unlock(folio);
folio_put(folio);
}

if (err)
Expand Down Expand Up @@ -1109,8 +1113,9 @@ static ssize_t ntfs_compress_write(struct kiocb *iocb, struct iov_iter *from)
for (ip = 0; ip < pages_per_frame;
ip++) {
page = pages[ip];
unlock_page(page);
put_page(page);
folio = page_folio(page);
folio_unlock(folio);
folio_put(folio);
}
goto out;
}
Expand Down Expand Up @@ -1151,9 +1156,10 @@ static ssize_t ntfs_compress_write(struct kiocb *iocb, struct iov_iter *from)
for (ip = 0; ip < pages_per_frame; ip++) {
page = pages[ip];
ClearPageDirty(page);
SetPageUptodate(page);
unlock_page(page);
put_page(page);
folio = page_folio(page);
folio_mark_uptodate(folio);
folio_unlock(folio);
folio_put(folio);
}

if (err)
Expand Down

0 comments on commit 678c190

Please sign in to comment.