f2fs: rename page_count with cache_count
Chao Yu
maintainerPATCH 1/2 f2fs: rename page_count with cache_count
From: Jaegeuk Kim <[email protected]>
The count does not indicate the number of pages anymore.
--- fs/f2fs/cache.c | 4 ++-- fs/f2fs/checkpoint.c | 30 ++++++++++++------------- fs/f2fs/compress.c | 8 +++---- fs/f2fs/data.c | 32 +++++++++++++-------------- fs/f2fs/debug.c | 26 +++++++++++----------- fs/f2fs/f2fs.h | 41 ++++++++++++++++++---------------- fs/f2fs/file.c | 14 ++++++------ fs/f2fs/gc.c | 14 ++++++------ fs/f2fs/node.c | 10 ++++----- fs/f2fs/segment.c | 10 ++++----- fs/f2fs/segment.h | 10 ++++----- fs/f2fs/super.c | 52 ++++++++++++++++++++++---------------------- 12 files changed, 127 insertions(+), 124 deletions(-)
fs/f2fs/cache.c +2 -2
@@ -78,7 +78,7 @@ bool f2fs_mark_cache_dirty(struct f2fs_cached_block *entry) IS_META_CACHE(cache) ? META : NODE);f2fs_cache_update_tag (entry,F2FS_CACHE_TAG_NONE ,F2FS_CACHE_TAG_DIRTY ); -inc_page_count (cache->sbi, type); +inc_cache_count (cache->sbi, type);return true; }
@@ -99,7 +99,7 @@ void f2fs_drop_cache_dirty(struct f2fs_cached_block *entry)f2fs_cache_update_tag (entry,F2FS_CACHE_TAG_DIRTY ,F2FS_CACHE_TAG_NONE ); -dec_page_count (cache->sbi, type); +dec_cache_count (cache->sbi, type); }void f2fs_start_cache_writeback (struct f2fs_cached_block *entry)
fs/f2fs/checkpoint.c +15 -15
@@ -555,7 +555,7 @@ static bool __f2fs_write_meta_cache(struct f2fs_cached_block *entry,if (unlikely (f2fs_cp_error (sbi))) {if (is_sbi_flag_set (sbi,SBI_IS_CLOSE )) {f2fs_cache_clear_uptodate (entry); -dec_page_count (sbi,F2FS_DIRTY_META ); +dec_cache_count (sbi,F2FS_DIRTY_META );f2fs_cache_update_tag (entry,F2FS_CACHE_TAG_DIRTY ,F2FS_CACHE_TAG_NONE );f2fs_unlock_cache (entry);
@@ -567,7 +567,7 @@ static bool __f2fs_write_meta_cache(struct f2fs_cached_block *entry, goto redirty_out;f2fs_do_write_meta_cache (sbi, entry, io_type); -dec_page_count (sbi,F2FS_DIRTY_META ); +dec_cache_count (sbi,F2FS_DIRTY_META );f2fs_unlock_cache (entry);
@@ -590,7 +590,7 @@ void f2fs_write_meta_caches(struct f2fs_sb_info *sbi)return ;/* collect a number of dirty meta caches and write together */ -if (get_pages (sbi,F2FS_DIRTY_META ) < +if (get_nr_caches (sbi,F2FS_DIRTY_META ) <nr_pages_to_skip (sbi,META ))return ;
@@ -1359,12 +1359,12 @@ int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type,unsigned long ino =0 ;trace_f2fs_sync_dirty_inodes_enter (sbi->sb, is_dir, -get_pages (sbi, is_dir ? +get_nr_caches (sbi, is_dir ?F2FS_DIRTY_DENTS :F2FS_DIRTY_DATA )); retry:if (unlikely (f2fs_cp_error (sbi))) {trace_f2fs_sync_dirty_inodes_exit (sbi->sb, is_dir, -get_pages (sbi, is_dir ? +get_nr_caches (sbi, is_dir ?F2FS_DIRTY_DENTS :F2FS_DIRTY_DATA ));return -EIO ; }
@@ -1375,7 +1375,7 @@ int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type,if (list_empty (head)) {spin_unlock (&sbi->inode_lock[type]);trace_f2fs_sync_dirty_inodes_exit (sbi->sb, is_dir, -get_pages (sbi, is_dir ? +get_nr_caches (sbi, is_dir ?F2FS_DIRTY_DENTS :F2FS_DIRTY_DATA ));return 0 ; }
@@ -1413,7 +1413,7 @@ static int f2fs_sync_inode_meta(struct f2fs_sb_info *sbi)struct list_head *head = &sbi->inode_list[DIRTY_META ];struct inode *inode;struct f2fs_inode_info *fi; -s64 total =get_pages (sbi,F2FS_DIRTY_IMETA ); +s64 total =get_nr_caches (sbi,F2FS_DIRTY_IMETA );while (total--) {if (unlikely (f2fs_cp_error (sbi)))
@@ -1477,7 +1477,7 @@ static bool __need_flush_quota(struct f2fs_sb_info *sbi) }else if (is_sbi_flag_set (sbi,SBI_QUOTA_NEED_FLUSH )) {clear_sbi_flag (sbi,SBI_QUOTA_NEED_FLUSH ); ret = true; - }else if (get_pages (sbi,F2FS_DIRTY_QDATA )) { + }else if (get_nr_caches (sbi,F2FS_DIRTY_QDATA )) { ret = true; }f2fs_up_write (&sbi->quota_sem);
@@ -1521,7 +1521,7 @@ static int block_operations(struct f2fs_sb_info *sbi) retry_flush_dents:/* write all the dirty dentry pages */ -if (get_pages (sbi,F2FS_DIRTY_DENTS )) { +if (get_nr_caches (sbi,F2FS_DIRTY_DENTS )) {f2fs_unlock_all (sbi); err =f2fs_sync_dirty_inodes (sbi,DIR_INODE , true);if (err)
@@ -1536,7 +1536,7 @@ static int block_operations(struct f2fs_sb_info *sbi)*/ f2fs_down_write (&sbi->node_change); -if (get_pages (sbi,F2FS_DIRTY_IMETA )) { +if (get_nr_caches (sbi,F2FS_DIRTY_IMETA )) {f2fs_up_write (&sbi->node_change);f2fs_unlock_all (sbi); err =f2fs_sync_inode_meta (sbi);
@@ -1549,7 +1549,7 @@ static int block_operations(struct f2fs_sb_info *sbi) retry_flush_nodes:f2fs_down_write (&sbi->node_write); -if (get_pages (sbi,F2FS_DIRTY_NODES )) { +if (get_nr_caches (sbi,F2FS_DIRTY_NODES )) {f2fs_up_write (&sbi->node_write);atomic_inc (&sbi->wb_sync_req[NODE ]); err = f2fs_writeback_node_caches(sbi, LONG_MAX,
@@ -1584,7 +1584,7 @@ void f2fs_sync_dirty_data(struct f2fs_sb_info *sbi, int type)DEFINE_WAIT (wait);for (;;) { -if (!get_pages (sbi, type)) +if (!get_nr_caches (sbi, type))break ; if (unlikely(f2fs_cp_error(sbi) &&
@@ -1906,11 +1906,11 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)* redirty superblock if metadata like node page or inode cache is * updated during writing checkpoint. */ -if (get_pages (sbi,F2FS_DIRTY_NODES ) || -get_pages (sbi,F2FS_DIRTY_IMETA )) +if (get_nr_caches (sbi,F2FS_DIRTY_NODES ) || +get_nr_caches (sbi,F2FS_DIRTY_IMETA ))set_sbi_flag (sbi,SBI_IS_DIRTY ); -f2fs_bug_on (sbi,get_pages (sbi,F2FS_DIRTY_DENTS )); +f2fs_bug_on (sbi,get_nr_caches (sbi,F2FS_DIRTY_DENTS ));return unlikely (f2fs_cp_error (sbi)) ? -EIO :0 ; }
fs/f2fs/compress.c +4 -4
@@ -807,7 +807,7 @@ void f2fs_end_read_compressed_page(struct folio *folio, bool failed,struct decompress_io_ctx *dic = folio->private;struct f2fs_sb_info *sbi = dic->sbi; -dec_page_count (sbi,F2FS_RD_DATA ); +dec_cache_count (sbi,F2FS_RD_DATA );if (failed)WRITE_ONCE (dic->failed, true);
@@ -1471,7 +1471,7 @@ void f2fs_compress_write_end_io(struct bio *bio, struct folio *folio)f2fs_compress_free_page (page);if (atomic_dec_return (&cic->pending_pages)) { -dec_page_count (sbi, type); +dec_cache_count (sbi, type);return ; }
@@ -1485,12 +1485,12 @@ void f2fs_compress_write_end_io(struct bio *bio, struct folio *folio)kmem_cache_free (cic_entry_slab, cic);/* -* Make sure dec_page_count() is the last access to sbi. +* Make sure dec_cache_count() is the last access to sbi. * Once it drops the F2FS_WB_CP_DATA counter to zero, the * unmount thread can proceed to destroy sbi and * sbi->page_array_slab. */ -dec_page_count (sbi, type); +dec_cache_count (sbi, type); } static int f2fs_write_raw_pages(struct compress_ctx *cc,
fs/f2fs/data.c +16 -16
@@ -143,7 +143,7 @@ static void f2fs_finish_read_bio(struct bio *bio, bool in_task) }while (nr_pages--) -dec_page_count (F2FS_F_SB (folio),F2FS_RD_DATA ); +dec_cache_count (F2FS_F_SB (folio),F2FS_RD_DATA );if (finished)folio_end_read (folio, bio->bi_status ==BLK_STS_OK );
@@ -327,13 +327,13 @@ static void f2fs_write_end_bio(struct bio *bio) } } -dec_page_count (sbi, type); +dec_cache_count (sbi, type);/* * we should access sbi before folio_end_writeback() to * avoid racing w/ kill_f2fs_super() */ -if (type ==F2FS_WB_CP_DATA && !get_pages (sbi, type) && +if (type ==F2FS_WB_CP_DATA && !get_nr_caches (sbi, type) &&wq_has_sleeper (&sbi->cp_wait))wake_up (&sbi->cp_wait);
@@ -396,7 +396,7 @@ static void f2fs_cache_read_end_io(struct bio *bio)if (bio->bi_status ==BLK_STS_OK )f2fs_cache_set_uptodate (entry); -dec_page_count (sbi, io_type); +dec_cache_count (sbi, io_type);f2fs_unlock_cache (entry); entry = next;
@@ -431,9 +431,9 @@ static void f2fs_cache_write_end_io(struct bio *bio)if (f2fs_in_warm_node_list (sbi, entry))f2fs_del_fsync_node_entry (sbi, entry); -dec_page_count (sbi,F2FS_WB_CP_DATA ); +dec_cache_count (sbi,F2FS_WB_CP_DATA ); -if (!get_pages (sbi,F2FS_WB_CP_DATA ) && +if (!get_nr_caches (sbi,F2FS_WB_CP_DATA ) &&wq_has_sleeper (&sbi->cp_wait))wake_up (&sbi->cp_wait);
@@ -874,7 +874,7 @@ int f2fs_submit_page_bio(struct f2fs_io_info *fio)if (fio->io_wbc && !is_read_io (fio->op))wbc_account_cgroup_owner (fio->io_wbc, fio_folio,PAGE_SIZE ); -inc_page_count (fio->sbi,is_read_io (fio->op) ? +inc_cache_count (fio->sbi,is_read_io (fio->op) ?F2FS_RD_DATA :WB_DATA_TYPE (fio->folio, false));if (is_read_io (bio_op (bio)))
@@ -1107,7 +1107,7 @@ int f2fs_merge_page_bio(struct f2fs_io_info *fio)if (fio->io_wbc)wbc_account_cgroup_owner (fio->io_wbc, folio,folio_size (folio)); -inc_page_count (fio->sbi,WB_DATA_TYPE (folio, false)); +inc_cache_count (fio->sbi,WB_DATA_TYPE (folio, false)); *fio->last_block = fio->new_blkaddr; *fio->bio = bio;
@@ -1205,7 +1205,7 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio) fio->submitted =1 ; type =WB_DATA_TYPE (bio_folio, fio->compressed_page); -inc_page_count (sbi, type); +inc_cache_count (sbi, type); if (io->bio && (!io_is_mergeable(sbi, io->bio, io, fio, io->last_block_in_bio,
@@ -1273,7 +1273,7 @@ int f2fs_submit_cache_read(struct f2fs_io_info *fio)bio_add_virt_nofail (bio,cache_address (entry), sbi->blocksize);f2fs_bio_add_cache (fio, bio); -inc_page_count (sbi, io_type); +inc_cache_count (sbi, io_type);f2fs_submit_read_bio (sbi, bio, fio->type);return 0 ;
@@ -1309,7 +1309,7 @@ void f2fs_submit_cache_write(struct f2fs_io_info *fio)verify_fio_blkaddr (fio); fio->submitted =1 ; -inc_page_count (sbi,F2FS_WB_CP_DATA ); +inc_cache_count (sbi,F2FS_WB_CP_DATA ); if (io->bio && (!io_is_mergeable(sbi, io->bio, io, fio, io->last_block_in_bio,
@@ -1409,7 +1409,7 @@ static void f2fs_submit_page_read(struct inode *inode, struct fsverity_info *vi,if (!bio_add_folio (bio, folio,PAGE_SIZE ,0 ))f2fs_bug_on (sbi,1 ); -inc_page_count (sbi,F2FS_RD_DATA ); +inc_cache_count (sbi,F2FS_RD_DATA );f2fs_update_iostat (sbi,NULL ,FS_DATA_READ_IO ,F2FS_BLKSIZE (sbi));f2fs_submit_read_bio (sbi, bio,DATA ); }
@@ -2525,7 +2525,7 @@ static int f2fs_read_single_page(struct inode *inode, struct fsverity_info *vi,if (!bio_add_folio (bio, folio, blocksize,0 )) goto submit_and_realloc; -inc_page_count (F2FS_I_SB (inode),F2FS_RD_DATA ); +inc_cache_count (F2FS_I_SB (inode),F2FS_RD_DATA );f2fs_update_iostat (F2FS_I_SB (inode),NULL ,FS_DATA_READ_IO ,F2FS_BLKSIZE (F2FS_I_SB (inode))); *last_block_in_bio = block_nr;
@@ -2677,7 +2677,7 @@ int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret, ctx->enabled_steps |=STEP_DECOMPRESS ;refcount_inc (&dic->refcnt); -inc_page_count (sbi,F2FS_RD_DATA ); +inc_cache_count (sbi,F2FS_RD_DATA );f2fs_update_iostat (sbi, inode,FS_DATA_READ_IO ,F2FS_BLKSIZE (sbi)); *last_block_in_bio = blkaddr;
@@ -2858,7 +2858,7 @@ static int f2fs_read_data_large_folio(struct inode *inode, goto submit_and_realloc; folio_in_bio = true; -inc_page_count (F2FS_I_SB (inode),F2FS_RD_DATA ); +inc_cache_count (F2FS_I_SB (inode),F2FS_RD_DATA );f2fs_update_iostat (F2FS_I_SB (inode),NULL ,FS_DATA_READ_IO ,F2FS_BLKSIZE (F2FS_I_SB (inode))); last_block_in_bio = block_nr;
@@ -3774,7 +3774,7 @@ static inline void update_skipped_write(struct f2fs_sb_info *sbi,if (is_sbi_flag_set (sbi,SBI_ENABLE_CHECKPOINT ) && skipped && wbc->sync_mode ==WB_SYNC_ALL ) -atomic_add (skipped, &sbi->nr_pages[F2FS_SKIPPED_WRITE ]); +atomic_add (skipped, &sbi->nr_caches[F2FS_SKIPPED_WRITE ]); } static int __f2fs_write_data_pages(struct address_space *mapping,
fs/f2fs/debug.c +13 -13
@@ -156,12 +156,12 @@ static void update_general_status(struct f2fs_sb_info *sbi) si->allocated_data_blocks =atomic64_read (&sbi->allocated_data_blocks);/* validation check of the segment numbers */ - si->ndirty_node =get_pages (sbi,F2FS_DIRTY_NODES ); - si->ndirty_dent =get_pages (sbi,F2FS_DIRTY_DENTS ); - si->ndirty_meta =get_pages (sbi,F2FS_DIRTY_META ); - si->ndirty_data =get_pages (sbi,F2FS_DIRTY_DATA ); - si->ndirty_qdata =get_pages (sbi,F2FS_DIRTY_QDATA ); - si->ndirty_imeta =get_pages (sbi,F2FS_DIRTY_IMETA ); + si->ndirty_node =get_nr_caches (sbi,F2FS_DIRTY_NODES ); + si->ndirty_dent =get_nr_caches (sbi,F2FS_DIRTY_DENTS ); + si->ndirty_meta =get_nr_caches (sbi,F2FS_DIRTY_META ); + si->ndirty_data =get_nr_caches (sbi,F2FS_DIRTY_DATA ); + si->ndirty_qdata =get_nr_caches (sbi,F2FS_DIRTY_QDATA ); + si->ndirty_imeta =get_nr_caches (sbi,F2FS_DIRTY_IMETA ); si->ndirty_dirs = sbi->ndirty_inode[DIR_INODE ]; si->ndirty_files = sbi->ndirty_inode[FILE_INODE ]; si->ndonate_files = sbi->donate_files;
@@ -169,13 +169,13 @@ static void update_general_status(struct f2fs_sb_info *sbi) si->ndirty_all = sbi->ndirty_inode[DIRTY_META ]; si->aw_cnt =atomic_read (&sbi->atomic_files); si->max_aw_cnt =atomic_read (&sbi->max_aw_cnt); - si->nr_dio_read =get_pages (sbi,F2FS_DIO_READ ); - si->nr_dio_write =get_pages (sbi,F2FS_DIO_WRITE ); - si->nr_wb_cp_data =get_pages (sbi,F2FS_WB_CP_DATA ); - si->nr_wb_data =get_pages (sbi,F2FS_WB_DATA ); - si->nr_rd_data =get_pages (sbi,F2FS_RD_DATA ); - si->nr_rd_node =get_pages (sbi,F2FS_RD_NODE ); - si->nr_rd_meta =get_pages (sbi,F2FS_RD_META ); + si->nr_dio_read =get_nr_caches (sbi,F2FS_DIO_READ ); + si->nr_dio_write =get_nr_caches (sbi,F2FS_DIO_WRITE ); + si->nr_wb_cp_data =get_nr_caches (sbi,F2FS_WB_CP_DATA ); + si->nr_wb_data =get_nr_caches (sbi,F2FS_WB_DATA ); + si->nr_rd_data =get_nr_caches (sbi,F2FS_RD_DATA ); + si->nr_rd_node =get_nr_caches (sbi,F2FS_RD_NODE ); + si->nr_rd_meta =get_nr_caches (sbi,F2FS_RD_META );if (SM_I (sbi)->fcc_info) { si->nr_flushed =atomic_read (&SM_I (sbi)->fcc_info->issued_flush);
fs/f2fs/f2fs.h +22 -19
98 lines not on this page · raw message
fs/f2fs/file.c +7 -7
@@ -5177,7 +5177,7 @@ static int f2fs_dio_read_end_io(struct kiocb *iocb, ssize_t size, int error, {struct f2fs_sb_info *sbi =F2FS_I_SB (file_inode (iocb->ki_filp)); -dec_page_count (sbi,F2FS_DIO_READ ); +dec_cache_count (sbi,F2FS_DIO_READ );if (error)return error;f2fs_update_iostat (sbi,NULL ,APP_DIRECT_READ_IO , size);
@@ -5235,13 +5235,13 @@ static ssize_t f2fs_dio_read_iter(struct kiocb *iocb, struct iov_iter *to)* the higher-level function iomap_dio_rw() in order to ensure that the * F2FS_DIO_READ counter will be decremented correctly in all cases. */ -inc_page_count (sbi,F2FS_DIO_READ ); +inc_cache_count (sbi,F2FS_DIO_READ ); dio =__iomap_dio_rw (iocb, to, &f2fs_iomap_ops, &f2fs_iomap_dio_read_ops,0 ,NULL ,0 );if (IS_ERR_OR_NULL (dio)) { ret =PTR_ERR_OR_ZERO (dio);if (ret != -EIOCBQUEUED ) -dec_page_count (sbi,F2FS_DIO_READ ); +dec_cache_count (sbi,F2FS_DIO_READ ); }else { ret =iomap_dio_complete (dio); }
@@ -5294,7 +5294,7 @@ static ssize_t f2fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)/* In LFS mode, if there is inflight dio, wait for its completion */ if (f2fs_lfs_mode (F2FS_I_SB (inode)) && -get_pages (F2FS_I_SB (inode),F2FS_DIO_WRITE ) && +get_nr_caches (F2FS_I_SB (inode),F2FS_DIO_WRITE ) && (!f2fs_is_pinned_file (inode) || !dio))inode_dio_wait (inode);
@@ -5460,7 +5460,7 @@ static int f2fs_dio_write_end_io(struct kiocb *iocb, ssize_t size, int error, {struct f2fs_sb_info *sbi =F2FS_I_SB (file_inode (iocb->ki_filp)); -dec_page_count (sbi,F2FS_DIO_WRITE ); +dec_cache_count (sbi,F2FS_DIO_WRITE );if (error)return error;f2fs_update_time (sbi,REQ_TIME );
@@ -5571,7 +5571,7 @@ static ssize_t f2fs_dio_write_iter(struct kiocb *iocb, struct iov_iter *from,* the higher-level function iomap_dio_rw() in order to ensure that the * F2FS_DIO_WRITE counter will be decremented correctly in all cases. */ -inc_page_count (sbi,F2FS_DIO_WRITE ); +inc_cache_count (sbi,F2FS_DIO_WRITE ); dio_flags =0 ;if (pos + count > inode->i_size) dio_flags |=IOMAP_DIO_FORCE_WAIT ;
@@ -5582,7 +5582,7 @@ static ssize_t f2fs_dio_write_iter(struct kiocb *iocb, struct iov_iter *from,if (ret == -ENOTBLK ) ret =0 ;if (ret != -EIOCBQUEUED ) -dec_page_count (sbi,F2FS_DIO_WRITE ); +dec_cache_count (sbi,F2FS_DIO_WRITE ); }else { ret =iomap_dio_complete (dio); }
fs/f2fs/gc.c +7 -7
@@ -1473,7 +1473,7 @@ static int move_data_block(struct inode *inode, block_t bidx,f2fs_mark_cache_dirty (tentry);if (f2fs_cache_test_and_clear_dirty (tentry)) -dec_page_count (fio.sbi,F2FS_DIRTY_META ); +dec_cache_count (fio.sbi,F2FS_DIRTY_META );f2fs_start_cache_writeback (tentry);
@@ -1979,9 +1979,9 @@ int f2fs_gc(struct f2fs_sb_info *sbi, struct f2fs_gc_control *gc_control) trace_f2fs_gc_begin(sbi->sb, gc_type, gc_control->no_bg_gc, gc_control->nr_free_secs, - get_pages(sbi, F2FS_DIRTY_NODES), - get_pages(sbi, F2FS_DIRTY_DENTS), - get_pages(sbi, F2FS_DIRTY_IMETA), + get_nr_caches(sbi, F2FS_DIRTY_NODES), + get_nr_caches(sbi, F2FS_DIRTY_DENTS), + get_nr_caches(sbi, F2FS_DIRTY_IMETA), free_sections(sbi), free_segments(sbi), reserved_segments(sbi),
@@ -2105,9 +2105,9 @@ int f2fs_gc(struct f2fs_sb_info *sbi, struct f2fs_gc_control *gc_control)f2fs_unpin_all_sections (sbi, true); trace_f2fs_gc_end(sbi->sb, ret, total_freed, total_sec_freed, - get_pages(sbi, F2FS_DIRTY_NODES), - get_pages(sbi, F2FS_DIRTY_DENTS), - get_pages(sbi, F2FS_DIRTY_IMETA), + get_nr_caches(sbi, F2FS_DIRTY_NODES), + get_nr_caches(sbi, F2FS_DIRTY_DENTS), + get_nr_caches(sbi, F2FS_DIRTY_IMETA), free_sections(sbi), free_segments(sbi), reserved_segments(sbi),
fs/f2fs/node.c +5 -5
@@ -85,7 +85,7 @@ bool f2fs_available_free_memory(struct f2fs_sb_info *sbi, int type) }else if (type ==DIRTY_DENTS ) {if (bdi_wb_dirty_exceeded (sbi->sb->s_bdi))return false; - mem_size =get_pages (sbi,F2FS_DIRTY_DENTS ); + mem_size =get_nr_caches (sbi,F2FS_DIRTY_DENTS ); res = mem_size < ((avail_ram * nm_i->ram_thresh /100 ) >>1 ); }else if (type ==INO_ENTRIES ) {int i;
@@ -1771,7 +1771,7 @@ static bool __write_node_cache(struct f2fs_cached_block *entry,f2fs_cache_clear_uptodate (entry);f2fs_cache_update_tag (entry,F2FS_CACHE_TAG_DIRTY ,F2FS_CACHE_TAG_NONE ); -dec_page_count (entry->cache->sbi,F2FS_DIRTY_NODES ); +dec_cache_count (entry->cache->sbi,F2FS_DIRTY_NODES );f2fs_unlock_cache (entry);return true; }
@@ -1803,7 +1803,7 @@ static bool __write_node_cache(struct f2fs_cached_block *entry,f2fs_cache_clear_uptodate (entry);f2fs_cache_update_tag (entry,F2FS_CACHE_TAG_DIRTY ,F2FS_CACHE_TAG_NONE ); -dec_page_count (entry->cache->sbi,F2FS_DIRTY_NODES ); +dec_cache_count (entry->cache->sbi,F2FS_DIRTY_NODES );f2fs_up_read_trace (&sbi->node_write, &lc);f2fs_unlock_cache (entry);return true;
@@ -1837,7 +1837,7 @@ static bool __write_node_cache(struct f2fs_cached_block *entry, fio.old_blkaddr = ni.blk_addr;f2fs_do_write_node_cache (nid, &fio);set_node_addr (sbi, &ni, fio.new_blkaddr,is_fsync_dnode (sbi, entry)); -dec_page_count (sbi,F2FS_DIRTY_NODES ); +dec_cache_count (sbi,F2FS_DIRTY_NODES );f2fs_up_read_trace (&sbi->node_write, &lc);f2fs_unlock_cache (entry);
@@ -2269,7 +2269,7 @@ int f2fs_write_node_caches(struct f2fs_sb_info *sbi)f2fs_balance_fs_bg (sbi, true);/* collect a number of dirty node caches and write together */ -if (get_pages (sbi,F2FS_DIRTY_NODES ) < +if (get_nr_caches (sbi,F2FS_DIRTY_NODES ) <nr_pages_to_skip (sbi,NODE ))return -EAGAIN ;
fs/f2fs/segment.c +5 -5
@@ -479,11 +479,11 @@ void f2fs_balance_fs(struct f2fs_sb_info *sbi, bool need)static inline bool excess_dirty_threshold (struct f2fs_sb_info *sbi) {int factor =f2fs_rwsem_is_locked (&sbi->cp_rwsem) ?3 :2 ; -unsigned int dents =get_pages (sbi,F2FS_DIRTY_DENTS ); -unsigned int qdata =get_pages (sbi,F2FS_DIRTY_QDATA ); -unsigned int nodes =get_pages (sbi,F2FS_DIRTY_NODES ); -unsigned int meta =get_pages (sbi,F2FS_DIRTY_META ); -unsigned int imeta =get_pages (sbi,F2FS_DIRTY_IMETA ); +unsigned int dents =get_nr_caches (sbi,F2FS_DIRTY_DENTS ); +unsigned int qdata =get_nr_caches (sbi,F2FS_DIRTY_QDATA ); +unsigned int nodes =get_nr_caches (sbi,F2FS_DIRTY_NODES ); +unsigned int meta =get_nr_caches (sbi,F2FS_DIRTY_META ); +unsigned int imeta =get_nr_caches (sbi,F2FS_DIRTY_IMETA );unsigned int threshold =SEGS_TO_BLKS (sbi, (factor *DEFAULT_DIRTY_THRESHOLD ));unsigned int global_threshold = threshold *3 /2 ;
fs/f2fs/segment.h +5 -5
@@ -656,15 +656,15 @@ static inline void get_additional_blocks_required(struct f2fs_sb_info *sbi,*/ static inline int __get_secs_required (struct f2fs_sb_info *sbi) { -unsigned int total_node_blocks =get_pages (sbi,F2FS_DIRTY_NODES ) + -get_pages (sbi,F2FS_DIRTY_DENTS ) + -get_pages (sbi,F2FS_DIRTY_IMETA ); -unsigned int total_dent_blocks =get_pages (sbi,F2FS_DIRTY_DENTS ); +unsigned int total_node_blocks =get_nr_caches (sbi,F2FS_DIRTY_NODES ) + +get_nr_caches (sbi,F2FS_DIRTY_DENTS ) + +get_nr_caches (sbi,F2FS_DIRTY_IMETA ); +unsigned int total_dent_blocks =get_nr_caches (sbi,F2FS_DIRTY_DENTS );unsigned int total_data_blocks =0 ;bool separate_dent = true;if (f2fs_lfs_mode (sbi)) - total_data_blocks =get_pages (sbi,F2FS_DIRTY_DATA ); + total_data_blocks =get_nr_caches (sbi,F2FS_DIRTY_DATA );/* * When active_logs != 4, dentry blocks and data blocks can be
fs/f2fs/super.c +26 -26
125 lines not on this page · raw message
Signature · 1 line
2.49.0
Chao Yu
maintainerPATCH 2/2 f2fs: rename nr_pages_to_skip with nr_caches_to_skip
From: Jaegeuk Kim <[email protected]>
The skipped count does not indicate the number of pages anymore.
--- fs/f2fs/checkpoint.c | 2 +- fs/f2fs/data.c | 2 +- fs/f2fs/node.c | 2 +- fs/f2fs/segment.h | 10 +++++----- 4 files changed, 8 insertions(+), 8 deletions(-)
fs/f2fs/checkpoint.c +1 -1
@@ -591,7 +591,7 @@ void f2fs_write_meta_caches(struct f2fs_sb_info *sbi)/* collect a number of dirty meta caches and write together */ if (get_nr_caches (sbi,F2FS_DIRTY_META ) < -nr_pages_to_skip (sbi,META )) +nr_caches_to_skip (sbi,META ))return ;/* if locked failed, cp will flush dirty caches instead */
fs/f2fs/data.c +1 -1
@@ -3797,7 +3797,7 @@ static int __f2fs_write_data_pages(struct address_space *mapping,if ((S_ISDIR (inode->i_mode) ||IS_NOQUOTA (inode)) && wbc->sync_mode ==WB_SYNC_NONE && -get_dirty_pages (inode) <nr_pages_to_skip (sbi,DATA ) && +get_dirty_pages (inode) <nr_caches_to_skip (sbi,DATA ) &&f2fs_available_free_memory (sbi,DIRTY_DENTS )) goto skip_write;
fs/f2fs/node.c +1 -1
@@ -2270,7 +2270,7 @@ int f2fs_write_node_caches(struct f2fs_sb_info *sbi)/* collect a number of dirty node caches and write together */ if (get_nr_caches (sbi,F2FS_DIRTY_NODES ) < -nr_pages_to_skip (sbi,NODE )) +nr_caches_to_skip (sbi,NODE ))return -EAGAIN ;if (atomic_read (&sbi->wb_sync_req[NODE ])) {
fs/f2fs/segment.h +5 -5
@@ -977,13 +977,13 @@ static inline bool sec_usage_check(struct f2fs_sb_info *sbi, unsigned int secno) }/* -* It is very important to gather dirty pages and write at once, so that we can +* It is very important to gather dirty blocks and write at once, so that we can * submit a big bio without interfering other data writes. -* By default, 512 pages for directory data, -* 512 pages (2MB) * 8 for nodes, and -* 256 pages * 8 for meta are set. +* By default, 512 blocks for directory data, +* 512 blocks (2MB) * 8 for nodes, and +* 256 blocks * 8 for meta are set. */ -static inline int nr_pages_to_skip (struct f2fs_sb_info *sbi,int type) +static inline int nr_caches_to_skip (struct f2fs_sb_info *sbi,int type) {if (bdi_wb_dirty_exceeded (sbi->sb->s_bdi))return 0 ;
Signature · 1 line
2.49.0
This series was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim <[email protected]>:
Hello:
This series was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <[email protected]>:
Quoted 5 lines · On Sat, 12 Sep 2026 07:25:09 +0800 you wrote:
From: Jaegeuk Kim <[email protected]>
The count does not indicate the number of pages anymore.
Signed-off-by Jaegeuk Kim <[email protected]>
Quoted 14 lines
--- fs/f2fs/cache.c | 4 ++-- fs/f2fs/checkpoint.c | 30 ++++++++++++------------- fs/f2fs/compress.c | 8 +++---- fs/f2fs/data.c | 32 +++++++++++++-------------- fs/f2fs/debug.c | 26 +++++++++++----------- fs/f2fs/f2fs.h | 41 ++++++++++++++++++---------------- fs/f2fs/file.c | 14 ++++++------ fs/f2fs/gc.c | 14 ++++++------ fs/f2fs/node.c | 10 ++++----- fs/f2fs/segment.c | 10 ++++----- fs/f2fs/segment.h | 10 ++++----- fs/f2fs/super.c | 52 ++++++++++++++++++++++---------------------- 12 files changed, 127 insertions(+), 124 deletions(-)
Here is the summary with links:
- [f2fs-dev,1/2] f2fs: rename page_count with cache_count (no matching commit)
- [f2fs-dev,2/2] f2fs: rename nr_pages_to_skip with nr_caches_to_skip
https://git.kernel.org/jaegeuk/f2fs/c/a4b9fb9e6911
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html