diff options
author | 2023-03-24 18:01:12 +0000 | |
---|---|---|
committer | 2023-04-06 13:39:51 -0400 | |
commit | 4ed9b598ac30913987ab46e0069620e6e8af82f0 (patch) | |
tree | ab18148cb39341c12fcd7274e1a95910c28927fb /fs/ext4/inline.c | |
parent | ext4: Convert ext4_try_to_write_inline_data() to use a folio (diff) | |
download | linux-4ed9b598ac30913987ab46e0069620e6e8af82f0.tar.gz linux-4ed9b598ac30913987ab46e0069620e6e8af82f0.tar.bz2 linux-4ed9b598ac30913987ab46e0069620e6e8af82f0.zip |
ext4: Convert ext4_da_convert_inline_data_to_extent() to use a folio
Saves a number of calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Link: https://lore.kernel.org/r/20230324180129.1220691-13-willy@infradead.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/inline.c')
-rw-r--r-- | fs/ext4/inline.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index 881d559c503f..45d74274d822 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c @@ -848,10 +848,11 @@ static int ext4_da_convert_inline_data_to_extent(struct address_space *mapping, void **fsdata) { int ret = 0, inline_size; - struct page *page; + struct folio *folio; - page = grab_cache_page_write_begin(mapping, 0); - if (!page) + folio = __filemap_get_folio(mapping, 0, FGP_WRITEBEGIN, + mapping_gfp_mask(mapping)); + if (!folio) return -ENOMEM; down_read(&EXT4_I(inode)->xattr_sem); @@ -862,32 +863,32 @@ static int ext4_da_convert_inline_data_to_extent(struct address_space *mapping, inline_size = ext4_get_inline_size(inode); - if (!PageUptodate(page)) { - ret = ext4_read_inline_page(inode, page); + if (!folio_test_uptodate(folio)) { + ret = ext4_read_inline_page(inode, &folio->page); if (ret < 0) goto out; } - ret = __block_write_begin(page, 0, inline_size, + ret = __block_write_begin(&folio->page, 0, inline_size, ext4_da_get_block_prep); if (ret) { up_read(&EXT4_I(inode)->xattr_sem); - unlock_page(page); - put_page(page); + folio_unlock(folio); + folio_put(folio); ext4_truncate_failed_write(inode); return ret; } - SetPageDirty(page); - SetPageUptodate(page); + folio_mark_dirty(folio); + folio_mark_uptodate(folio); ext4_clear_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA); *fsdata = (void *)CONVERT_INLINE_DATA; out: up_read(&EXT4_I(inode)->xattr_sem); - if (page) { - unlock_page(page); - put_page(page); + if (folio) { + folio_unlock(folio); + folio_put(folio); } return ret; } |