Re: [PATCH 3/6] memory-failure: Remove calls to page_mapping()

2024-04-23 Thread Sidhartha Kumar

On 4/23/24 3:55 PM, Matthew Wilcox (Oracle) wrote:

This is mostly just inlining page_mapping() into the two callers.

Signed-off-by: Matthew Wilcox (Oracle) 
---
  mm/memory-failure.c | 6 --
  1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index e065dd9be21e..62aa3db17854 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -216,6 +216,7 @@ EXPORT_SYMBOL_GPL(hwpoison_filter_flags_value);
  
  static int hwpoison_filter_dev(struct page *p)

  {
+   struct folio *folio = page_folio(p);
struct address_space *mapping;
dev_t dev;
  
@@ -223,7 +224,7 @@ static int hwpoison_filter_dev(struct page *p)

hwpoison_filter_dev_minor == ~0U)
return 0;
  
-	mapping = page_mapping(p);

+   mapping = folio_mapping(folio);
if (mapping == NULL || mapping->host == NULL)
return -EINVAL;
  
@@ -1090,7 +1091,8 @@ static int me_pagecache_clean(struct page_state *ps, struct page *p)

   */
  static int me_pagecache_dirty(struct page_state *ps, struct page *p)
  {
-   struct address_space *mapping = page_mapping(p);
+   struct folio *folio = page_folio(p);
+   struct address_space *mapping = folio_mapping(folio);
  
  	/* TBD: print more information about the file. */

if (mapping) {

Reviewed-by: Sidhartha Kumar 



Re: [PATCH 1/6] fscrypt: Convert bh_get_inode_and_lblk_num to use a folio

2024-04-23 Thread Eric Biggers
On Tue, Apr 23, 2024 at 11:55:32PM +0100, Matthew Wilcox (Oracle) wrote:
> Remove uses of page->index, page_mapping() and b_page.  Saves a call
> to compound_head().
> 
> Signed-off-by: Matthew Wilcox (Oracle) 
> ---
>  fs/crypto/inline_crypt.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/crypto/inline_crypt.c b/fs/crypto/inline_crypt.c
> index b4002aea7cdb..40de69860dcf 100644
> --- a/fs/crypto/inline_crypt.c
> +++ b/fs/crypto/inline_crypt.c
> @@ -284,7 +284,7 @@ static bool bh_get_inode_and_lblk_num(const struct 
> buffer_head *bh,
> const struct inode **inode_ret,
> u64 *lblk_num_ret)
>  {
> - struct page *page = bh->b_page;
> + struct folio *folio = bh->b_folio;
>   const struct address_space *mapping;
>   const struct inode *inode;
>  
> @@ -292,13 +292,13 @@ static bool bh_get_inode_and_lblk_num(const struct 
> buffer_head *bh,
>* The ext4 journal (jbd2) can submit a buffer_head it directly created
>* for a non-pagecache page.  fscrypt doesn't care about these.
>*/
> - mapping = page_mapping(page);
> + mapping = folio_mapping(folio);
>   if (!mapping)
>   return false;
>   inode = mapping->host;
>  
>   *inode_ret = inode;
> - *lblk_num_ret = ((u64)page->index << (PAGE_SHIFT - inode->i_blkbits)) +
> + *lblk_num_ret = ((u64)folio->index << (PAGE_SHIFT - inode->i_blkbits)) +
>   (bh_offset(bh) >> inode->i_blkbits);
>   return true;
>  }

Reviewed-by: Eric Biggers 

- Eric



Re: [f2fs-dev] [PATCH v2 3/8] f2fs: drop usage of page_index

2024-04-23 Thread Matthew Wilcox
On Wed, Apr 24, 2024 at 01:03:34AM +0800, Kairui Song wrote:
> @@ -4086,8 +4086,7 @@ void f2fs_clear_page_cache_dirty_tag(struct page *page)
>   unsigned long flags;
>  
>   xa_lock_irqsave(>i_pages, flags);
> - __xa_clear_mark(>i_pages, page_index(page),
> - PAGECACHE_TAG_DIRTY);
> + __xa_clear_mark(>i_pages, page->index, PAGECACHE_TAG_DIRTY);
>   xa_unlock_irqrestore(>i_pages, flags);
>  }

I just sent a patch which is going to conflict with this:

https://lore.kernel.org/linux-mm/20240423225552.4113447-3-wi...@infradead.org/

Chao Yu, Jaegeuk Kim; what are your plans for converting f2fs to use
folios?  This is getting quite urgent.


___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[PATCH 0/6] Remove page_mapping()

2024-04-23 Thread Matthew Wilcox (Oracle)
There are only a few users left.  Convert them all to either call
folio_mapping() or just use folio->mapping directly.

Matthew Wilcox (Oracle) (6):
  fscrypt: Convert bh_get_inode_and_lblk_num to use a folio
  f2fs: Convert f2fs_clear_page_cache_dirty_tag to use a folio
  memory-failure: Remove calls to page_mapping()
  migrate: Expand the use of folio in __migrate_device_pages()
  userfault; Expand folio use in mfill_atomic_install_pte()
  mm: Remove page_mapping()

 fs/crypto/inline_crypt.c |  6 +++---
 fs/f2fs/data.c   |  5 +++--
 include/linux/pagemap.h  |  1 -
 mm/folio-compat.c|  6 --
 mm/memory-failure.c  |  6 --
 mm/migrate_device.c  | 13 +
 mm/userfaultfd.c |  5 ++---
 7 files changed, 17 insertions(+), 25 deletions(-)

-- 
2.43.0




[PATCH 5/6] userfault; Expand folio use in mfill_atomic_install_pte()

2024-04-23 Thread Matthew Wilcox (Oracle)
Call page_folio() a little earlier so we can use folio_mapping()
instead of page_mapping(), saving a call to compound_head().

Signed-off-by: Matthew Wilcox (Oracle) 
---
 mm/userfaultfd.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c
index d9dcc7d71a39..e6486923263c 100644
--- a/mm/userfaultfd.c
+++ b/mm/userfaultfd.c
@@ -180,9 +180,9 @@ int mfill_atomic_install_pte(pmd_t *dst_pmd,
pte_t _dst_pte, *dst_pte;
bool writable = dst_vma->vm_flags & VM_WRITE;
bool vm_shared = dst_vma->vm_flags & VM_SHARED;
-   bool page_in_cache = page_mapping(page);
spinlock_t *ptl;
-   struct folio *folio;
+   struct folio *folio = page_folio(page);
+   bool page_in_cache = folio_mapping(folio);
 
_dst_pte = mk_pte(page, dst_vma->vm_page_prot);
_dst_pte = pte_mkdirty(_dst_pte);
@@ -212,7 +212,6 @@ int mfill_atomic_install_pte(pmd_t *dst_pmd,
if (!pte_none_mostly(ptep_get(dst_pte)))
goto out_unlock;
 
-   folio = page_folio(page);
if (page_in_cache) {
/* Usually, cache pages are already added to LRU */
if (newly_allocated)
-- 
2.43.0




[PATCH 2/6] f2fs: Convert f2fs_clear_page_cache_dirty_tag to use a folio

2024-04-23 Thread Matthew Wilcox (Oracle)
Removes uses of page_mapping() and page_index().

Signed-off-by: Matthew Wilcox (Oracle) 
---
 fs/f2fs/data.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 5d641fac02ba..9f74c867d790 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -4100,11 +4100,12 @@ const struct address_space_operations f2fs_dblock_aops 
= {
 
 void f2fs_clear_page_cache_dirty_tag(struct page *page)
 {
-   struct address_space *mapping = page_mapping(page);
+   struct folio *folio = page_folio(page);
+   struct address_space *mapping = folio->mapping;
unsigned long flags;
 
xa_lock_irqsave(>i_pages, flags);
-   __xa_clear_mark(>i_pages, page_index(page),
+   __xa_clear_mark(>i_pages, folio->index,
PAGECACHE_TAG_DIRTY);
xa_unlock_irqrestore(>i_pages, flags);
 }
-- 
2.43.0




[PATCH 6/6] mm: Remove page_mapping()

2024-04-23 Thread Matthew Wilcox (Oracle)
All callers are now converted, delete this compatibility wrapper.

Signed-off-by: Matthew Wilcox (Oracle) 
---
 include/linux/pagemap.h | 1 -
 mm/folio-compat.c   | 6 --
 2 files changed, 7 deletions(-)

diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index b6f14e9a2d98..941f7ed714b9 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -399,7 +399,6 @@ static inline void filemap_nr_thps_dec(struct address_space 
*mapping)
 #endif
 }
 
-struct address_space *page_mapping(struct page *);
 struct address_space *folio_mapping(struct folio *);
 struct address_space *swapcache_mapping(struct folio *);
 
diff --git a/mm/folio-compat.c b/mm/folio-compat.c
index f31e0ce65b11..f05906006b3c 100644
--- a/mm/folio-compat.c
+++ b/mm/folio-compat.c
@@ -10,12 +10,6 @@
 #include 
 #include "internal.h"
 
-struct address_space *page_mapping(struct page *page)
-{
-   return folio_mapping(page_folio(page));
-}
-EXPORT_SYMBOL(page_mapping);
-
 void unlock_page(struct page *page)
 {
return folio_unlock(page_folio(page));
-- 
2.43.0




[PATCH 1/6] fscrypt: Convert bh_get_inode_and_lblk_num to use a folio

2024-04-23 Thread Matthew Wilcox (Oracle)
Remove uses of page->index, page_mapping() and b_page.  Saves a call
to compound_head().

Signed-off-by: Matthew Wilcox (Oracle) 
---
 fs/crypto/inline_crypt.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/crypto/inline_crypt.c b/fs/crypto/inline_crypt.c
index b4002aea7cdb..40de69860dcf 100644
--- a/fs/crypto/inline_crypt.c
+++ b/fs/crypto/inline_crypt.c
@@ -284,7 +284,7 @@ static bool bh_get_inode_and_lblk_num(const struct 
buffer_head *bh,
  const struct inode **inode_ret,
  u64 *lblk_num_ret)
 {
-   struct page *page = bh->b_page;
+   struct folio *folio = bh->b_folio;
const struct address_space *mapping;
const struct inode *inode;
 
@@ -292,13 +292,13 @@ static bool bh_get_inode_and_lblk_num(const struct 
buffer_head *bh,
 * The ext4 journal (jbd2) can submit a buffer_head it directly created
 * for a non-pagecache page.  fscrypt doesn't care about these.
 */
-   mapping = page_mapping(page);
+   mapping = folio_mapping(folio);
if (!mapping)
return false;
inode = mapping->host;
 
*inode_ret = inode;
-   *lblk_num_ret = ((u64)page->index << (PAGE_SHIFT - inode->i_blkbits)) +
+   *lblk_num_ret = ((u64)folio->index << (PAGE_SHIFT - inode->i_blkbits)) +
(bh_offset(bh) >> inode->i_blkbits);
return true;
 }
-- 
2.43.0




[PATCH 3/6] memory-failure: Remove calls to page_mapping()

2024-04-23 Thread Matthew Wilcox (Oracle)
This is mostly just inlining page_mapping() into the two callers.

Signed-off-by: Matthew Wilcox (Oracle) 
---
 mm/memory-failure.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index e065dd9be21e..62aa3db17854 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -216,6 +216,7 @@ EXPORT_SYMBOL_GPL(hwpoison_filter_flags_value);
 
 static int hwpoison_filter_dev(struct page *p)
 {
+   struct folio *folio = page_folio(p);
struct address_space *mapping;
dev_t dev;
 
@@ -223,7 +224,7 @@ static int hwpoison_filter_dev(struct page *p)
hwpoison_filter_dev_minor == ~0U)
return 0;
 
-   mapping = page_mapping(p);
+   mapping = folio_mapping(folio);
if (mapping == NULL || mapping->host == NULL)
return -EINVAL;
 
@@ -1090,7 +1091,8 @@ static int me_pagecache_clean(struct page_state *ps, 
struct page *p)
  */
 static int me_pagecache_dirty(struct page_state *ps, struct page *p)
 {
-   struct address_space *mapping = page_mapping(p);
+   struct folio *folio = page_folio(p);
+   struct address_space *mapping = folio_mapping(folio);
 
/* TBD: print more information about the file. */
if (mapping) {
-- 
2.43.0




[PATCH 4/6] migrate: Expand the use of folio in __migrate_device_pages()

2024-04-23 Thread Matthew Wilcox (Oracle)
Removes a few calls to compound_head() and a call to page_mapping().

Signed-off-by: Matthew Wilcox (Oracle) 
---
 mm/migrate_device.c | 13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/mm/migrate_device.c b/mm/migrate_device.c
index a68616c1965f..aecc71972a87 100644
--- a/mm/migrate_device.c
+++ b/mm/migrate_device.c
@@ -692,6 +692,7 @@ static void __migrate_device_pages(unsigned long *src_pfns,
struct page *newpage = migrate_pfn_to_page(dst_pfns[i]);
struct page *page = migrate_pfn_to_page(src_pfns[i]);
struct address_space *mapping;
+   struct folio *folio;
int r;
 
if (!newpage) {
@@ -726,15 +727,12 @@ static void __migrate_device_pages(unsigned long 
*src_pfns,
continue;
}
 
-   mapping = page_mapping(page);
+   folio = page_folio(page);
+   mapping = folio_mapping(folio);
 
if (is_device_private_page(newpage) ||
is_device_coherent_page(newpage)) {
if (mapping) {
-   struct folio *folio;
-
-   folio = page_folio(page);
-
/*
 * For now only support anonymous memory 
migrating to
 * device private or coherent memory.
@@ -757,11 +755,10 @@ static void __migrate_device_pages(unsigned long 
*src_pfns,
 
if (migrate && migrate->fault_page == page)
r = migrate_folio_extra(mapping, page_folio(newpage),
-   page_folio(page),
-   MIGRATE_SYNC_NO_COPY, 1);
+   folio, MIGRATE_SYNC_NO_COPY, 1);
else
r = migrate_folio(mapping, page_folio(newpage),
-   page_folio(page), MIGRATE_SYNC_NO_COPY);
+   folio, MIGRATE_SYNC_NO_COPY);
if (r != MIGRATEPAGE_SUCCESS)
src_pfns[i] &= ~MIGRATE_PFN_MIGRATE;
}
-- 
2.43.0




Re: [f2fs-dev] [PATCH 2/3 v2] f2fs: clear writeback when compression failed

2024-04-23 Thread Daeho Jeong
On Tue, Apr 16, 2024 at 9:50 AM Jaegeuk Kim  wrote:
>
> Let's stop issuing compressed writes and clear their writeback flags.
>
> Signed-off-by: Jaegeuk Kim 
> ---
>
>  Now, I don't see any kernel hang for 24hours.
>
>  Change log from v1:
>   - fix bugs
>
>  fs/f2fs/compress.c | 40 ++--
>  1 file changed, 38 insertions(+), 2 deletions(-)
>
> diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
> index d67c471ab5df..b12d3a49bfda 100644
> --- a/fs/f2fs/compress.c
> +++ b/fs/f2fs/compress.c
> @@ -1031,6 +1031,31 @@ static void set_cluster_writeback(struct compress_ctx 
> *cc)
> }
>  }
>
> +static void cancel_cluster_writeback(struct compress_ctx *cc,
> +   struct compress_io_ctx *cic, int submitted)
> +{
> +   int i;
> +
> +   /* Wait for submitted IOs. */
> +   if (submitted > 1) {
> +   f2fs_submit_merged_write(F2FS_I_SB(cc->inode), DATA);
> +   while (atomic_read(>pending_pages) !=
> +   (cc->valid_nr_cpages - submitted + 1))
> +   f2fs_io_schedule_timeout(DEFAULT_IO_TIMEOUT);
> +   }
> +
> +   /* Cancel writeback and stay locked. */
> +   for (i = 0; i < cc->cluster_size; i++) {
> +   if (i < submitted) {
> +   inode_inc_dirty_pages(cc->inode);
> +   lock_page(cc->rpages[i]);
> +   }
> +   clear_page_private_gcing(cc->rpages[i]);
> +   if (folio_test_writeback(page_folio(cc->rpages[i])))
> +   end_page_writeback(cc->rpages[i]);
> +   }
> +}
> +
>  static void set_cluster_dirty(struct compress_ctx *cc)
>  {
> int i;
> @@ -1232,7 +1257,6 @@ static int f2fs_write_compressed_pages(struct 
> compress_ctx *cc,
> .page = NULL,
> .encrypted_page = NULL,
> .compressed_page = NULL,
> -   .submitted = 0,
> .io_type = io_type,
> .io_wbc = wbc,
> .encrypted = fscrypt_inode_uses_fs_layer_crypto(cc->inode) ?
> @@ -1358,7 +1382,16 @@ static int f2fs_write_compressed_pages(struct 
> compress_ctx *cc,
> fio.compressed_page = cc->cpages[i - 1];
>
> cc->cpages[i - 1] = NULL;
> +   fio.submitted = 0;
> f2fs_outplace_write_data(, );
> +   if (unlikely(!fio.submitted)) {
> +   cancel_cluster_writeback(cc, cic, i);
> +
> +   /* To call fscrypt_finalize_bounce_page */
> +   i = cc->valid_nr_cpages;
> +   *submitted = 0;
> +   goto out_destroy_crypt;
> +   }
> (*submitted)++;
>  unlock_continue:
> inode_dec_dirty_pages(cc->inode);
> @@ -1392,8 +1425,11 @@ static int f2fs_write_compressed_pages(struct 
> compress_ctx *cc,
>  out_destroy_crypt:
> page_array_free(cc->inode, cic->rpages, cc->cluster_size);
>
> -   for (--i; i >= 0; i--)
> +   for (--i; i >= 0; i--) {
> +   if (!cc->cpages[i])
> +   continue;
> fscrypt_finalize_bounce_page(>cpages[i]);
> +   }
>  out_put_cic:
> kmem_cache_free(cic_entry_slab, cic);
>  out_put_dnode:
> --
> 2.44.0.683.g7961c838ac-goog
>
>
>
> ___
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reviewed-by: Daeho Jeong 

Thanks,


___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH 1/2] f2fs: fix comment in sanity_check_raw_super()

2024-04-23 Thread patchwork-bot+f2fs
Hello:

This series was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim :

On Tue, 16 Apr 2024 15:21:07 +0800 you wrote:
> Commit d7e9a9037de2 ("f2fs: Support Block Size == Page Size") missed to
> adjust comment in sanity_check_raw_super(), fix it.
> 
> Signed-off-by: Chao Yu 
> ---
>  fs/f2fs/super.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
  - [f2fs-dev,1/2] f2fs: fix comment in sanity_check_raw_super()
https://git.kernel.org/jaegeuk/f2fs/c/5bf624c01229
  - [f2fs-dev,2/2] f2fs: remove unnecessary block size check in init_f2fs_fs()
https://git.kernel.org/jaegeuk/f2fs/c/06b206d9e2b4

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] Patchwork summary for: f2fs

2024-04-23 Thread patchwork-bot+f2fs
Hello:

The following patches were marked "accepted", because they were applied to
jaegeuk/f2fs.git (dev):

Series: [f2fs-dev,v2,1/4] f2fs: convert f2fs_mpage_readpages() to use folio
  Submitter: Chao Yu 
  Patchwork: https://patchwork.kernel.org/project/f2fs/list/?series=846491
  Lore link: https://lore.kernel.org/r/20240422062417.2421616-1-c...@kernel.org
Patches: [f2fs-dev,v2,1/4] f2fs: convert f2fs_mpage_readpages() to use folio
 [f2fs-dev,v2,3/4] f2fs: convert f2fs_read_inline_data() to use 
folio
 [f2fs-dev,v2,4/4] f2fs: convert f2fs__page tracepoint class to use 
folio

Series: [f2fs-dev,1/2] f2fs: fix comment in sanity_check_raw_super()
  Submitter: Chao Yu 
  Committer: Jaegeuk Kim 
  Patchwork: https://patchwork.kernel.org/project/f2fs/list/?series=844949
  Lore link: https://lore.kernel.org/r/20240416072108.5819-1-c...@kernel.org
Patches: [f2fs-dev,1/2] f2fs: fix comment in sanity_check_raw_super()
 [f2fs-dev,2/2] f2fs: remove unnecessary block size check in 
init_f2fs_fs()


Total patches: 5

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH v2 1/4] f2fs: convert f2fs_mpage_readpages() to use folio

2024-04-23 Thread patchwork-bot+f2fs
Hello:

This series was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim :

On Mon, 22 Apr 2024 14:24:14 +0800 you wrote:
> Convert f2fs_mpage_readpages() to use folio and related
> functionality.
> 
> Signed-off-by: Chao Yu 
> ---
> v2:
> - fix compile warning w/o CONFIG_F2FS_FS_COMPRESSION reported by lkp
>  fs/f2fs/data.c | 81 +-
>  1 file changed, 40 insertions(+), 41 deletions(-)

Here is the summary with links:
  - [f2fs-dev,v2,1/4] f2fs: convert f2fs_mpage_readpages() to use folio
(no matching commit)
  - [f2fs-dev,v2,2/4] f2fs: convert f2fs_read_single_page() to use folio
(no matching commit)
  - [f2fs-dev,v2,3/4] f2fs: convert f2fs_read_inline_data() to use folio
https://git.kernel.org/jaegeuk/f2fs/c/96ea46f30b26
  - [f2fs-dev,v2,4/4] f2fs: convert f2fs__page tracepoint class to use folio
https://git.kernel.org/jaegeuk/f2fs/c/92f750d847c9

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] [PATCH v2 3/8] f2fs: drop usage of page_index

2024-04-23 Thread Kairui Song
From: Kairui Song 

page_index is needed for mixed usage of page cache and swap cache,
for pure page cache usage, the caller can just use page->index instead.

It can't be a swap cache page here, so just drop it.

Signed-off-by: Kairui Song 
Cc: Chao Yu 
Cc: Jaegeuk Kim 
Cc: linux-f2fs-devel@lists.sourceforge.net
---
 fs/f2fs/data.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index d9494b5fc7c1..12d5bbd18755 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -2057,7 +2057,7 @@ static int f2fs_read_single_page(struct inode *inode, 
struct page *page,
sector_t block_nr;
int ret = 0;
 
-   block_in_file = (sector_t)page_index(page);
+   block_in_file = (sector_t)page->index;
last_block = block_in_file + nr_pages;
last_block_in_file = bytes_to_blks(inode,
f2fs_readpage_limit(inode) + blocksize - 1);
@@ -4086,8 +4086,7 @@ void f2fs_clear_page_cache_dirty_tag(struct page *page)
unsigned long flags;
 
xa_lock_irqsave(>i_pages, flags);
-   __xa_clear_mark(>i_pages, page_index(page),
-   PAGECACHE_TAG_DIRTY);
+   __xa_clear_mark(>i_pages, page->index, PAGECACHE_TAG_DIRTY);
xa_unlock_irqrestore(>i_pages, flags);
 }
 
-- 
2.44.0



___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] [PATCH] f2fs: use helper to print zone condition

2024-04-23 Thread Wu Bo via Linux-f2fs-devel
To make code clean, use blk_zone_cond_str() to print debug information.

Signed-off-by: Wu Bo 
---
 fs/f2fs/segment.c | 17 +++--
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index f0da516ba8dc..22d56b99f930 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -4961,17 +4961,6 @@ static int sanity_check_curseg(struct f2fs_sb_info *sbi)
 }
 
 #ifdef CONFIG_BLK_DEV_ZONED
-static const char *f2fs_zone_status[BLK_ZONE_COND_OFFLINE + 1] = {
-   [BLK_ZONE_COND_NOT_WP]  = "NOT_WP",
-   [BLK_ZONE_COND_EMPTY]   = "EMPTY",
-   [BLK_ZONE_COND_IMP_OPEN]= "IMPLICIT_OPEN",
-   [BLK_ZONE_COND_EXP_OPEN]= "EXPLICIT_OPEN",
-   [BLK_ZONE_COND_CLOSED]  = "CLOSED",
-   [BLK_ZONE_COND_READONLY]= "READONLY",
-   [BLK_ZONE_COND_FULL]= "FULL",
-   [BLK_ZONE_COND_OFFLINE] = "OFFLINE",
-};
-
 static int check_zone_write_pointer(struct f2fs_sb_info *sbi,
struct f2fs_dev_info *fdev,
struct blk_zone *zone)
@@ -5002,7 +4991,7 @@ static int check_zone_write_pointer(struct f2fs_sb_info 
*sbi,
if (IS_CURSEC(sbi, GET_SEC_FROM_SEG(sbi, zone_segno))) {
f2fs_notice(sbi, "Open zones: valid block[0x%x,0x%x] cond[%s]",
zone_segno, valid_block_cnt,
-   f2fs_zone_status[zone->cond]);
+   blk_zone_cond_str(zone->cond));
return 0;
}
 
@@ -5013,7 +5002,7 @@ static int check_zone_write_pointer(struct f2fs_sb_info 
*sbi,
if (!valid_block_cnt) {
f2fs_notice(sbi, "Zone without valid block has non-zero write "
"pointer. Reset the write pointer: cond[%s]",
-   f2fs_zone_status[zone->cond]);
+   blk_zone_cond_str(zone->cond));
ret = __f2fs_issue_discard_zone(sbi, fdev->bdev, zone_block,
zone->len >> log_sectors_per_block);
if (ret)
@@ -5031,7 +5020,7 @@ static int check_zone_write_pointer(struct f2fs_sb_info 
*sbi,
 */
f2fs_notice(sbi, "Valid blocks are not aligned with write "
"pointer: valid block[0x%x,0x%x] cond[%s]",
-   zone_segno, valid_block_cnt, f2fs_zone_status[zone->cond]);
+   zone_segno, valid_block_cnt, blk_zone_cond_str(zone->cond));
 
nofs_flags = memalloc_nofs_save();
ret = blkdev_zone_mgmt(fdev->bdev, REQ_OP_ZONE_FINISH,
-- 
2.35.3



___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel