f2fs.h (8dd06ef34b6e2f41b29fbf5fc1663780f2524285) | f2fs.h (0b6d4ca04a86b9dababbb76e58d33c437e127b77) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 | 1/* SPDX-License-Identifier: GPL-2.0 */ |
2/* 3 * fs/f2fs/f2fs.h 4 * 5 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 6 * http://www.samsung.com/ 7 */ 8#ifndef _LINUX_F2FS_H 9#define _LINUX_F2FS_H --- 7 unchanged lines hidden (view full) --- 17#include <linux/magic.h> 18#include <linux/kobject.h> 19#include <linux/sched.h> 20#include <linux/cred.h> 21#include <linux/vmalloc.h> 22#include <linux/bio.h> 23#include <linux/blkdev.h> 24#include <linux/quotaops.h> | 2/* 3 * fs/f2fs/f2fs.h 4 * 5 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 6 * http://www.samsung.com/ 7 */ 8#ifndef _LINUX_F2FS_H 9#define _LINUX_F2FS_H --- 7 unchanged lines hidden (view full) --- 17#include <linux/magic.h> 18#include <linux/kobject.h> 19#include <linux/sched.h> 20#include <linux/cred.h> 21#include <linux/vmalloc.h> 22#include <linux/bio.h> 23#include <linux/blkdev.h> 24#include <linux/quotaops.h> |
25#include <linux/part_stat.h> |
|
25#include <crypto/hash.h> 26 27#include <linux/fscrypt.h> 28#include <linux/fsverity.h> 29 30#ifdef CONFIG_F2FS_CHECK_FS 31#define f2fs_bug_on(sbi, condition) BUG_ON(condition) 32#else --- 36 unchanged lines hidden (view full) --- 69 70extern const char *f2fs_fault_name[FAULT_MAX]; 71#define IS_FAULT_SET(fi, type) ((fi)->inject_type & (1 << (type))) 72#endif 73 74/* 75 * For mount options 76 */ | 26#include <crypto/hash.h> 27 28#include <linux/fscrypt.h> 29#include <linux/fsverity.h> 30 31#ifdef CONFIG_F2FS_CHECK_FS 32#define f2fs_bug_on(sbi, condition) BUG_ON(condition) 33#else --- 36 unchanged lines hidden (view full) --- 70 71extern const char *f2fs_fault_name[FAULT_MAX]; 72#define IS_FAULT_SET(fi, type) ((fi)->inject_type & (1 << (type))) 73#endif 74 75/* 76 * For mount options 77 */ |
77#define F2FS_MOUNT_BG_GC 0x00000001 | |
78#define F2FS_MOUNT_DISABLE_ROLL_FORWARD 0x00000002 79#define F2FS_MOUNT_DISCARD 0x00000004 80#define F2FS_MOUNT_NOHEAP 0x00000008 81#define F2FS_MOUNT_XATTR_USER 0x00000010 82#define F2FS_MOUNT_POSIX_ACL 0x00000020 83#define F2FS_MOUNT_DISABLE_EXT_IDENTIFY 0x00000040 84#define F2FS_MOUNT_INLINE_XATTR 0x00000080 85#define F2FS_MOUNT_INLINE_DATA 0x00000100 86#define F2FS_MOUNT_INLINE_DENTRY 0x00000200 87#define F2FS_MOUNT_FLUSH_MERGE 0x00000400 88#define F2FS_MOUNT_NOBARRIER 0x00000800 89#define F2FS_MOUNT_FASTBOOT 0x00001000 90#define F2FS_MOUNT_EXTENT_CACHE 0x00002000 | 78#define F2FS_MOUNT_DISABLE_ROLL_FORWARD 0x00000002 79#define F2FS_MOUNT_DISCARD 0x00000004 80#define F2FS_MOUNT_NOHEAP 0x00000008 81#define F2FS_MOUNT_XATTR_USER 0x00000010 82#define F2FS_MOUNT_POSIX_ACL 0x00000020 83#define F2FS_MOUNT_DISABLE_EXT_IDENTIFY 0x00000040 84#define F2FS_MOUNT_INLINE_XATTR 0x00000080 85#define F2FS_MOUNT_INLINE_DATA 0x00000100 86#define F2FS_MOUNT_INLINE_DENTRY 0x00000200 87#define F2FS_MOUNT_FLUSH_MERGE 0x00000400 88#define F2FS_MOUNT_NOBARRIER 0x00000800 89#define F2FS_MOUNT_FASTBOOT 0x00001000 90#define F2FS_MOUNT_EXTENT_CACHE 0x00002000 |
91#define F2FS_MOUNT_FORCE_FG_GC 0x00004000 | |
92#define F2FS_MOUNT_DATA_FLUSH 0x00008000 93#define F2FS_MOUNT_FAULT_INJECTION 0x00010000 | 91#define F2FS_MOUNT_DATA_FLUSH 0x00008000 92#define F2FS_MOUNT_FAULT_INJECTION 0x00010000 |
94#define F2FS_MOUNT_ADAPTIVE 0x00020000 95#define F2FS_MOUNT_LFS 0x00040000 | |
96#define F2FS_MOUNT_USRQUOTA 0x00080000 97#define F2FS_MOUNT_GRPQUOTA 0x00100000 98#define F2FS_MOUNT_PRJQUOTA 0x00200000 99#define F2FS_MOUNT_QUOTA 0x00400000 100#define F2FS_MOUNT_INLINE_XATTR_SIZE 0x00800000 101#define F2FS_MOUNT_RESERVE_ROOT 0x01000000 102#define F2FS_MOUNT_DISABLE_CHECKPOINT 0x02000000 | 93#define F2FS_MOUNT_USRQUOTA 0x00080000 94#define F2FS_MOUNT_GRPQUOTA 0x00100000 95#define F2FS_MOUNT_PRJQUOTA 0x00200000 96#define F2FS_MOUNT_QUOTA 0x00400000 97#define F2FS_MOUNT_INLINE_XATTR_SIZE 0x00800000 98#define F2FS_MOUNT_RESERVE_ROOT 0x01000000 99#define F2FS_MOUNT_DISABLE_CHECKPOINT 0x02000000 |
100#define F2FS_MOUNT_NORECOVERY 0x04000000 |
|
103 104#define F2FS_OPTION(sbi) ((sbi)->mount_opt) 105#define clear_opt(sbi, option) (F2FS_OPTION(sbi).opt &= ~F2FS_MOUNT_##option) 106#define set_opt(sbi, option) (F2FS_OPTION(sbi).opt |= F2FS_MOUNT_##option) 107#define test_opt(sbi, option) (F2FS_OPTION(sbi).opt & F2FS_MOUNT_##option) 108 109#define ver_after(a, b) (typecheck(unsigned long long, a) && \ 110 typecheck(unsigned long long, b) && \ --- 22 unchanged lines hidden (view full) --- 133 /* Names of quota files with journalled quota */ 134 char *s_qf_names[MAXQUOTAS]; 135 int s_jquota_fmt; /* Format of quota to use */ 136#endif 137 /* For which write hints are passed down to block layer */ 138 int whint_mode; 139 int alloc_mode; /* segment allocation policy */ 140 int fsync_mode; /* fsync policy */ | 101 102#define F2FS_OPTION(sbi) ((sbi)->mount_opt) 103#define clear_opt(sbi, option) (F2FS_OPTION(sbi).opt &= ~F2FS_MOUNT_##option) 104#define set_opt(sbi, option) (F2FS_OPTION(sbi).opt |= F2FS_MOUNT_##option) 105#define test_opt(sbi, option) (F2FS_OPTION(sbi).opt & F2FS_MOUNT_##option) 106 107#define ver_after(a, b) (typecheck(unsigned long long, a) && \ 108 typecheck(unsigned long long, b) && \ --- 22 unchanged lines hidden (view full) --- 131 /* Names of quota files with journalled quota */ 132 char *s_qf_names[MAXQUOTAS]; 133 int s_jquota_fmt; /* Format of quota to use */ 134#endif 135 /* For which write hints are passed down to block layer */ 136 int whint_mode; 137 int alloc_mode; /* segment allocation policy */ 138 int fsync_mode; /* fsync policy */ |
139 int fs_mode; /* fs mode: LFS or ADAPTIVE */ 140 int bggc_mode; /* bggc mode: off, on or sync */ |
|
141 bool test_dummy_encryption; /* test dummy encryption */ | 141 bool test_dummy_encryption; /* test dummy encryption */ |
142 block_t unusable_cap_perc; /* percentage for cap */ |
|
142 block_t unusable_cap; /* Amount of space allowed to be 143 * unusable when disabling checkpoint 144 */ 145 146 /* For compression */ 147 unsigned char compress_algorithm; /* algorithm type */ 148 unsigned compress_log_size; /* cluster log size */ 149 unsigned char compress_ext_cnt; /* extension count */ --- 39 unchanged lines hidden (view full) --- 189 190#define CP_UMOUNT 0x00000001 191#define CP_FASTBOOT 0x00000002 192#define CP_SYNC 0x00000004 193#define CP_RECOVERY 0x00000008 194#define CP_DISCARD 0x00000010 195#define CP_TRIMMED 0x00000020 196#define CP_PAUSE 0x00000040 | 143 block_t unusable_cap; /* Amount of space allowed to be 144 * unusable when disabling checkpoint 145 */ 146 147 /* For compression */ 148 unsigned char compress_algorithm; /* algorithm type */ 149 unsigned compress_log_size; /* cluster log size */ 150 unsigned char compress_ext_cnt; /* extension count */ --- 39 unchanged lines hidden (view full) --- 190 191#define CP_UMOUNT 0x00000001 192#define CP_FASTBOOT 0x00000002 193#define CP_SYNC 0x00000004 194#define CP_RECOVERY 0x00000008 195#define CP_DISCARD 0x00000010 196#define CP_TRIMMED 0x00000020 197#define CP_PAUSE 0x00000040 |
198#define CP_RESIZE 0x00000080 |
|
197 198#define MAX_DISCARD_BLOCKS(sbi) BLKS_PER_SEC(sbi) 199#define DEF_MAX_DISCARD_REQUEST 8 /* issue 8 discards per round */ 200#define DEF_MIN_DISCARD_ISSUE_TIME 50 /* 50 ms, if exists */ 201#define DEF_MID_DISCARD_ISSUE_TIME 500 /* 500 ms, if device busy */ 202#define DEF_MAX_DISCARD_ISSUE_TIME 60000 /* 60 s, if no candidates */ 203#define DEF_DISCARD_URGENT_UTIL 80 /* do more discard over 80% */ 204#define DEF_CP_INTERVAL 60 /* 60 secs */ --- 121 unchanged lines hidden (view full) --- 326 unsigned int min_interval; /* used for candidates exist */ 327 unsigned int mid_interval; /* used for device busy */ 328 unsigned int max_interval; /* used for candidates not exist */ 329 unsigned int max_requests; /* # of discards issued per round */ 330 unsigned int io_aware_gran; /* minimum granularity discard not be aware of I/O */ 331 bool io_aware; /* issue discard in idle time */ 332 bool sync; /* submit discard with REQ_SYNC flag */ 333 bool ordered; /* issue discard by lba order */ | 199 200#define MAX_DISCARD_BLOCKS(sbi) BLKS_PER_SEC(sbi) 201#define DEF_MAX_DISCARD_REQUEST 8 /* issue 8 discards per round */ 202#define DEF_MIN_DISCARD_ISSUE_TIME 50 /* 50 ms, if exists */ 203#define DEF_MID_DISCARD_ISSUE_TIME 500 /* 500 ms, if device busy */ 204#define DEF_MAX_DISCARD_ISSUE_TIME 60000 /* 60 s, if no candidates */ 205#define DEF_DISCARD_URGENT_UTIL 80 /* do more discard over 80% */ 206#define DEF_CP_INTERVAL 60 /* 60 secs */ --- 121 unchanged lines hidden (view full) --- 328 unsigned int min_interval; /* used for candidates exist */ 329 unsigned int mid_interval; /* used for device busy */ 330 unsigned int max_interval; /* used for candidates not exist */ 331 unsigned int max_requests; /* # of discards issued per round */ 332 unsigned int io_aware_gran; /* minimum granularity discard not be aware of I/O */ 333 bool io_aware; /* issue discard in idle time */ 334 bool sync; /* submit discard with REQ_SYNC flag */ 335 bool ordered; /* issue discard by lba order */ |
336 bool timeout; /* discard timeout for put_super */ |
|
334 unsigned int granularity; /* discard granularity */ | 337 unsigned int granularity; /* discard granularity */ |
335 int timeout; /* discard timeout for put_super */ | |
336}; 337 338struct discard_cmd_control { 339 struct task_struct *f2fs_issue_discard; /* discard thread */ 340 struct list_head entry_list; /* 4KB discard entry list */ 341 struct list_head pend_list[MAX_PLIST_NUM];/* store pending entries */ 342 struct list_head wait_list; /* store on-flushing entries */ 343 struct list_head fstrim_list; /* in-flight discard from fstrim */ --- 78 unchanged lines hidden (view full) --- 422 struct f2fs_flush_device) 423#define F2FS_IOC_GARBAGE_COLLECT_RANGE _IOW(F2FS_IOCTL_MAGIC, 11, \ 424 struct f2fs_gc_range) 425#define F2FS_IOC_GET_FEATURES _IOR(F2FS_IOCTL_MAGIC, 12, __u32) 426#define F2FS_IOC_SET_PIN_FILE _IOW(F2FS_IOCTL_MAGIC, 13, __u32) 427#define F2FS_IOC_GET_PIN_FILE _IOR(F2FS_IOCTL_MAGIC, 14, __u32) 428#define F2FS_IOC_PRECACHE_EXTENTS _IO(F2FS_IOCTL_MAGIC, 15) 429#define F2FS_IOC_RESIZE_FS _IOW(F2FS_IOCTL_MAGIC, 16, __u64) | 338}; 339 340struct discard_cmd_control { 341 struct task_struct *f2fs_issue_discard; /* discard thread */ 342 struct list_head entry_list; /* 4KB discard entry list */ 343 struct list_head pend_list[MAX_PLIST_NUM];/* store pending entries */ 344 struct list_head wait_list; /* store on-flushing entries */ 345 struct list_head fstrim_list; /* in-flight discard from fstrim */ --- 78 unchanged lines hidden (view full) --- 424 struct f2fs_flush_device) 425#define F2FS_IOC_GARBAGE_COLLECT_RANGE _IOW(F2FS_IOCTL_MAGIC, 11, \ 426 struct f2fs_gc_range) 427#define F2FS_IOC_GET_FEATURES _IOR(F2FS_IOCTL_MAGIC, 12, __u32) 428#define F2FS_IOC_SET_PIN_FILE _IOW(F2FS_IOCTL_MAGIC, 13, __u32) 429#define F2FS_IOC_GET_PIN_FILE _IOR(F2FS_IOCTL_MAGIC, 14, __u32) 430#define F2FS_IOC_PRECACHE_EXTENTS _IO(F2FS_IOCTL_MAGIC, 15) 431#define F2FS_IOC_RESIZE_FS _IOW(F2FS_IOCTL_MAGIC, 16, __u64) |
432#define F2FS_IOC_GET_COMPRESS_BLOCKS _IOR(F2FS_IOCTL_MAGIC, 17, __u64) 433#define F2FS_IOC_RELEASE_COMPRESS_BLOCKS \ 434 _IOR(F2FS_IOCTL_MAGIC, 18, __u64) 435#define F2FS_IOC_RESERVE_COMPRESS_BLOCKS \ 436 _IOR(F2FS_IOCTL_MAGIC, 19, __u64) |
|
430 431#define F2FS_IOC_GET_VOLUME_NAME FS_IOC_GETFSLABEL 432#define F2FS_IOC_SET_VOLUME_NAME FS_IOC_SETFSLABEL 433 434#define F2FS_IOC_SET_ENCRYPTION_POLICY FS_IOC_SET_ENCRYPTION_POLICY 435#define F2FS_IOC_GET_ENCRYPTION_POLICY FS_IOC_GET_ENCRYPTION_POLICY 436#define F2FS_IOC_GET_ENCRYPTION_PWSALT FS_IOC_GET_ENCRYPTION_PWSALT 437 --- 62 unchanged lines hidden (view full) --- 500 ((SIZE_OF_DIR_ENTRY + F2FS_SLOT_LEN) * \ 501 NR_INLINE_DENTRY(inode) + \ 502 INLINE_DENTRY_BITMAP_SIZE(inode))) 503 504/* 505 * For INODE and NODE manager 506 */ 507/* for directory operations */ | 437 438#define F2FS_IOC_GET_VOLUME_NAME FS_IOC_GETFSLABEL 439#define F2FS_IOC_SET_VOLUME_NAME FS_IOC_SETFSLABEL 440 441#define F2FS_IOC_SET_ENCRYPTION_POLICY FS_IOC_SET_ENCRYPTION_POLICY 442#define F2FS_IOC_GET_ENCRYPTION_POLICY FS_IOC_GET_ENCRYPTION_POLICY 443#define F2FS_IOC_GET_ENCRYPTION_PWSALT FS_IOC_GET_ENCRYPTION_PWSALT 444 --- 62 unchanged lines hidden (view full) --- 507 ((SIZE_OF_DIR_ENTRY + F2FS_SLOT_LEN) * \ 508 NR_INLINE_DENTRY(inode) + \ 509 INLINE_DENTRY_BITMAP_SIZE(inode))) 510 511/* 512 * For INODE and NODE manager 513 */ 514/* for directory operations */ |
515 516struct f2fs_filename { 517 /* 518 * The filename the user specified. This is NULL for some 519 * filesystem-internal operations, e.g. converting an inline directory 520 * to a non-inline one, or roll-forward recovering an encrypted dentry. 521 */ 522 const struct qstr *usr_fname; 523 524 /* 525 * The on-disk filename. For encrypted directories, this is encrypted. 526 * This may be NULL for lookups in an encrypted dir without the key. 527 */ 528 struct fscrypt_str disk_name; 529 530 /* The dirhash of this filename */ 531 f2fs_hash_t hash; 532 533#ifdef CONFIG_FS_ENCRYPTION 534 /* 535 * For lookups in encrypted directories: either the buffer backing 536 * disk_name, or a buffer that holds the decoded no-key name. 537 */ 538 struct fscrypt_str crypto_buf; 539#endif 540#ifdef CONFIG_UNICODE 541 /* 542 * For casefolded directories: the casefolded name, but it's left NULL 543 * if the original name is not valid Unicode or if the filesystem is 544 * doing an internal operation where usr_fname is also NULL. In these 545 * cases we fall back to treating the name as an opaque byte sequence. 546 */ 547 struct fscrypt_str cf_name; 548#endif 549}; 550 |
|
508struct f2fs_dentry_ptr { 509 struct inode *inode; 510 void *bitmap; 511 struct f2fs_dir_entry *dentry; 512 __u8 (*filename)[F2FS_SLOT_LEN]; 513 int max; 514 int nr_bitmap; 515}; --- 38 unchanged lines hidden (view full) --- 554 LOOKUP_NODE_RA, /* 555 * look up a node with readahead called 556 * by get_data_block. 557 */ 558}; 559 560#define DEFAULT_RETRY_IO_COUNT 8 /* maximum retry read IO count */ 561 | 551struct f2fs_dentry_ptr { 552 struct inode *inode; 553 void *bitmap; 554 struct f2fs_dir_entry *dentry; 555 __u8 (*filename)[F2FS_SLOT_LEN]; 556 int max; 557 int nr_bitmap; 558}; --- 38 unchanged lines hidden (view full) --- 597 LOOKUP_NODE_RA, /* 598 * look up a node with readahead called 599 * by get_data_block. 600 */ 601}; 602 603#define DEFAULT_RETRY_IO_COUNT 8 /* maximum retry read IO count */ 604 |
605/* congestion wait timeout value, default: 20ms */ 606#define DEFAULT_IO_TIMEOUT (msecs_to_jiffies(20)) 607 |
|
562/* maximum retry quota flush count */ 563#define DEFAULT_RETRY_QUOTA_FLUSH_COUNT 8 564 565#define F2FS_LINK_MAX 0xffffffff /* maximum link count per file */ 566 567#define MAX_DIR_RA_PAGES 4 /* maximum ra pages of dir */ 568 569/* for in-memory extent cache entry */ --- 100 unchanged lines hidden (view full) --- 670#define DEF_DIR_LEVEL 0 671 672enum { 673 GC_FAILURE_PIN, 674 GC_FAILURE_ATOMIC, 675 MAX_GC_FAILURE 676}; 677 | 608/* maximum retry quota flush count */ 609#define DEFAULT_RETRY_QUOTA_FLUSH_COUNT 8 610 611#define F2FS_LINK_MAX 0xffffffff /* maximum link count per file */ 612 613#define MAX_DIR_RA_PAGES 4 /* maximum ra pages of dir */ 614 615/* for in-memory extent cache entry */ --- 100 unchanged lines hidden (view full) --- 716#define DEF_DIR_LEVEL 0 717 718enum { 719 GC_FAILURE_PIN, 720 GC_FAILURE_ATOMIC, 721 MAX_GC_FAILURE 722}; 723 |
724/* used for f2fs_inode_info->flags */ 725enum { 726 FI_NEW_INODE, /* indicate newly allocated inode */ 727 FI_DIRTY_INODE, /* indicate inode is dirty or not */ 728 FI_AUTO_RECOVER, /* indicate inode is recoverable */ 729 FI_DIRTY_DIR, /* indicate directory has dirty pages */ 730 FI_INC_LINK, /* need to increment i_nlink */ 731 FI_ACL_MODE, /* indicate acl mode */ 732 FI_NO_ALLOC, /* should not allocate any blocks */ 733 FI_FREE_NID, /* free allocated nide */ 734 FI_NO_EXTENT, /* not to use the extent cache */ 735 FI_INLINE_XATTR, /* used for inline xattr */ 736 FI_INLINE_DATA, /* used for inline data*/ 737 FI_INLINE_DENTRY, /* used for inline dentry */ 738 FI_APPEND_WRITE, /* inode has appended data */ 739 FI_UPDATE_WRITE, /* inode has in-place-update data */ 740 FI_NEED_IPU, /* used for ipu per file */ 741 FI_ATOMIC_FILE, /* indicate atomic file */ 742 FI_ATOMIC_COMMIT, /* indicate the state of atomical committing */ 743 FI_VOLATILE_FILE, /* indicate volatile file */ 744 FI_FIRST_BLOCK_WRITTEN, /* indicate #0 data block was written */ 745 FI_DROP_CACHE, /* drop dirty page cache */ 746 FI_DATA_EXIST, /* indicate data exists */ 747 FI_INLINE_DOTS, /* indicate inline dot dentries */ 748 FI_DO_DEFRAG, /* indicate defragment is running */ 749 FI_DIRTY_FILE, /* indicate regular/symlink has dirty pages */ 750 FI_NO_PREALLOC, /* indicate skipped preallocated blocks */ 751 FI_HOT_DATA, /* indicate file is hot */ 752 FI_EXTRA_ATTR, /* indicate file has extra attribute */ 753 FI_PROJ_INHERIT, /* indicate file inherits projectid */ 754 FI_PIN_FILE, /* indicate file should not be gced */ 755 FI_ATOMIC_REVOKE_REQUEST, /* request to drop atomic data */ 756 FI_VERITY_IN_PROGRESS, /* building fs-verity Merkle tree */ 757 FI_COMPRESSED_FILE, /* indicate file's data can be compressed */ 758 FI_MMAP_FILE, /* indicate file was mmapped */ 759 FI_MAX, /* max flag, never be used */ 760}; 761 |
|
678struct f2fs_inode_info { 679 struct inode vfs_inode; /* serve a vfs inode */ 680 unsigned long i_flags; /* keep an inode flags for ioctl */ 681 unsigned char i_advise; /* use to give file attribute hints */ 682 unsigned char i_dir_level; /* use for dentry level for large dir */ 683 unsigned int i_current_depth; /* only for directory depth */ 684 /* for gc failure statistic */ 685 unsigned int i_gc_failures[MAX_GC_FAILURE]; 686 unsigned int i_pino; /* parent inode number */ 687 umode_t i_acl_mode; /* keep file acl mode temporarily */ 688 689 /* Use below internally in f2fs*/ | 762struct f2fs_inode_info { 763 struct inode vfs_inode; /* serve a vfs inode */ 764 unsigned long i_flags; /* keep an inode flags for ioctl */ 765 unsigned char i_advise; /* use to give file attribute hints */ 766 unsigned char i_dir_level; /* use for dentry level for large dir */ 767 unsigned int i_current_depth; /* only for directory depth */ 768 /* for gc failure statistic */ 769 unsigned int i_gc_failures[MAX_GC_FAILURE]; 770 unsigned int i_pino; /* parent inode number */ 771 umode_t i_acl_mode; /* keep file acl mode temporarily */ 772 773 /* Use below internally in f2fs*/ |
690 unsigned long flags; /* use to pass per-file flags */ | 774 unsigned long flags[BITS_TO_LONGS(FI_MAX)]; /* use to pass per-file flags */ |
691 struct rw_semaphore i_sem; /* protect fi info */ 692 atomic_t dirty_pages; /* # of dirty pages */ 693 f2fs_hash_t chash; /* hash value of given file name */ 694 unsigned int clevel; /* maximum level of given file name */ 695 struct task_struct *task; /* lookup and create consistency */ 696 struct task_struct *cp_task; /* separate cp/wb IO stats*/ 697 nid_t i_xattr_nid; /* node id that contains xattrs */ 698 loff_t last_disk_size; /* lastly written file size */ | 775 struct rw_semaphore i_sem; /* protect fi info */ 776 atomic_t dirty_pages; /* # of dirty pages */ 777 f2fs_hash_t chash; /* hash value of given file name */ 778 unsigned int clevel; /* maximum level of given file name */ 779 struct task_struct *task; /* lookup and create consistency */ 780 struct task_struct *cp_task; /* separate cp/wb IO stats*/ 781 nid_t i_xattr_nid; /* node id that contains xattrs */ 782 loff_t last_disk_size; /* lastly written file size */ |
783 spinlock_t i_size_lock; /* protect last_disk_size */ |
|
699 700#ifdef CONFIG_QUOTA 701 struct dquot *i_dquot[MAXQUOTAS]; 702 703 /* quota space reservation, managed internally by quota code */ 704 qsize_t i_reserved_quota; 705#endif 706 struct list_head dirty_list; /* dirty list for dirs and files */ --- 333 unchanged lines hidden (view full) --- 1040 CP_NO_SPC_ROLL, 1041 CP_NODE_NEED_CP, 1042 CP_FASTBOOT_MODE, 1043 CP_SPEC_LOG_NUM, 1044 CP_RECOVER_DIR, 1045}; 1046 1047enum iostat_type { | 784 785#ifdef CONFIG_QUOTA 786 struct dquot *i_dquot[MAXQUOTAS]; 787 788 /* quota space reservation, managed internally by quota code */ 789 qsize_t i_reserved_quota; 790#endif 791 struct list_head dirty_list; /* dirty list for dirs and files */ --- 333 unchanged lines hidden (view full) --- 1125 CP_NO_SPC_ROLL, 1126 CP_NODE_NEED_CP, 1127 CP_FASTBOOT_MODE, 1128 CP_SPEC_LOG_NUM, 1129 CP_RECOVER_DIR, 1130}; 1131 1132enum iostat_type { |
1048 APP_DIRECT_IO, /* app direct IOs */ 1049 APP_BUFFERED_IO, /* app buffered IOs */ | 1133 /* WRITE IO */ 1134 APP_DIRECT_IO, /* app direct write IOs */ 1135 APP_BUFFERED_IO, /* app buffered write IOs */ |
1050 APP_WRITE_IO, /* app write IOs */ 1051 APP_MAPPED_IO, /* app mapped IOs */ 1052 FS_DATA_IO, /* data IOs from kworker/fsync/reclaimer */ 1053 FS_NODE_IO, /* node IOs from kworker/fsync/reclaimer */ 1054 FS_META_IO, /* meta IOs from kworker/reclaimer */ 1055 FS_GC_DATA_IO, /* data IOs from forground gc */ 1056 FS_GC_NODE_IO, /* node IOs from forground gc */ 1057 FS_CP_DATA_IO, /* data IOs from checkpoint */ 1058 FS_CP_NODE_IO, /* node IOs from checkpoint */ 1059 FS_CP_META_IO, /* meta IOs from checkpoint */ | 1136 APP_WRITE_IO, /* app write IOs */ 1137 APP_MAPPED_IO, /* app mapped IOs */ 1138 FS_DATA_IO, /* data IOs from kworker/fsync/reclaimer */ 1139 FS_NODE_IO, /* node IOs from kworker/fsync/reclaimer */ 1140 FS_META_IO, /* meta IOs from kworker/reclaimer */ 1141 FS_GC_DATA_IO, /* data IOs from forground gc */ 1142 FS_GC_NODE_IO, /* node IOs from forground gc */ 1143 FS_CP_DATA_IO, /* data IOs from checkpoint */ 1144 FS_CP_NODE_IO, /* node IOs from checkpoint */ 1145 FS_CP_META_IO, /* meta IOs from checkpoint */ |
1146 1147 /* READ IO */ 1148 APP_DIRECT_READ_IO, /* app direct read IOs */ 1149 APP_BUFFERED_READ_IO, /* app buffered read IOs */ 1150 APP_READ_IO, /* app read IOs */ 1151 APP_MAPPED_READ_IO, /* app mapped read IOs */ 1152 FS_DATA_READ_IO, /* data read IOs */ 1153 FS_GDATA_READ_IO, /* data read IOs from background gc */ 1154 FS_CDATA_READ_IO, /* compressed data read IOs */ 1155 FS_NODE_READ_IO, /* node read IOs */ 1156 FS_META_READ_IO, /* meta read IOs */ 1157 1158 /* other */ |
|
1060 FS_DISCARD, /* discard */ 1061 NR_IO_TYPE, 1062}; 1063 1064struct f2fs_io_info { 1065 struct f2fs_sb_info *sbi; /* f2fs_sb_info pointer */ 1066 nid_t ino; /* inode number */ 1067 enum page_type type; /* contains DATA/NODE/META/META_FLUSH */ --- 99 unchanged lines hidden (view full) --- 1167enum { 1168 GC_NORMAL, 1169 GC_IDLE_CB, 1170 GC_IDLE_GREEDY, 1171 GC_URGENT, 1172}; 1173 1174enum { | 1159 FS_DISCARD, /* discard */ 1160 NR_IO_TYPE, 1161}; 1162 1163struct f2fs_io_info { 1164 struct f2fs_sb_info *sbi; /* f2fs_sb_info pointer */ 1165 nid_t ino; /* inode number */ 1166 enum page_type type; /* contains DATA/NODE/META/META_FLUSH */ --- 99 unchanged lines hidden (view full) --- 1266enum { 1267 GC_NORMAL, 1268 GC_IDLE_CB, 1269 GC_IDLE_GREEDY, 1270 GC_URGENT, 1271}; 1272 1273enum { |
1274 BGGC_MODE_ON, /* background gc is on */ 1275 BGGC_MODE_OFF, /* background gc is off */ 1276 BGGC_MODE_SYNC, /* 1277 * background gc is on, migrating blocks 1278 * like foreground gc 1279 */ 1280}; 1281 1282enum { 1283 FS_MODE_ADAPTIVE, /* use both lfs/ssr allocation */ 1284 FS_MODE_LFS, /* use lfs allocation only */ 1285}; 1286 1287enum { |
|
1175 WHINT_MODE_OFF, /* not pass down write hints */ 1176 WHINT_MODE_USER, /* try to pass down hints given by users */ 1177 WHINT_MODE_FS, /* pass down hints with F2FS policy */ 1178}; 1179 1180enum { 1181 ALLOC_MODE_DEFAULT, /* stay default */ 1182 ALLOC_MODE_REUSE, /* reuse segments as much as possible */ --- 23 unchanged lines hidden (view full) --- 1206#else 1207#define DUMMY_ENCRYPTION_ENABLED(sbi) (0) 1208#endif 1209 1210/* For compression */ 1211enum compress_algorithm_type { 1212 COMPRESS_LZO, 1213 COMPRESS_LZ4, | 1288 WHINT_MODE_OFF, /* not pass down write hints */ 1289 WHINT_MODE_USER, /* try to pass down hints given by users */ 1290 WHINT_MODE_FS, /* pass down hints with F2FS policy */ 1291}; 1292 1293enum { 1294 ALLOC_MODE_DEFAULT, /* stay default */ 1295 ALLOC_MODE_REUSE, /* reuse segments as much as possible */ --- 23 unchanged lines hidden (view full) --- 1319#else 1320#define DUMMY_ENCRYPTION_ENABLED(sbi) (0) 1321#endif 1322 1323/* For compression */ 1324enum compress_algorithm_type { 1325 COMPRESS_LZO, 1326 COMPRESS_LZ4, |
1327 COMPRESS_ZSTD, 1328 COMPRESS_LZORLE, |
|
1214 COMPRESS_MAX, 1215}; 1216 | 1329 COMPRESS_MAX, 1330}; 1331 |
1217#define COMPRESS_DATA_RESERVED_SIZE 4 | 1332#define COMPRESS_DATA_RESERVED_SIZE 5 |
1218struct compress_data { 1219 __le32 clen; /* compressed data size */ | 1333struct compress_data { 1334 __le32 clen; /* compressed data size */ |
1220 __le32 chksum; /* checksum of compressed data */ | |
1221 __le32 reserved[COMPRESS_DATA_RESERVED_SIZE]; /* reserved */ 1222 u8 cdata[]; /* compressed data */ 1223}; 1224 1225#define COMPRESS_HEADER_SIZE (sizeof(struct compress_data)) 1226 1227#define F2FS_COMPRESSED_PAGE_MAGIC 0xF5F2C000 1228 --- 7 unchanged lines hidden (view full) --- 1236 unsigned int nr_rpages; /* total page number in rpages */ 1237 struct page **cpages; /* pages store compressed data in cluster */ 1238 unsigned int nr_cpages; /* total page number in cpages */ 1239 void *rbuf; /* virtual mapped address on rpages */ 1240 struct compress_data *cbuf; /* virtual mapped address on cpages */ 1241 size_t rlen; /* valid data length in rbuf */ 1242 size_t clen; /* valid data length in cbuf */ 1243 void *private; /* payload buffer for specified compression algorithm */ | 1335 __le32 reserved[COMPRESS_DATA_RESERVED_SIZE]; /* reserved */ 1336 u8 cdata[]; /* compressed data */ 1337}; 1338 1339#define COMPRESS_HEADER_SIZE (sizeof(struct compress_data)) 1340 1341#define F2FS_COMPRESSED_PAGE_MAGIC 0xF5F2C000 1342 --- 7 unchanged lines hidden (view full) --- 1350 unsigned int nr_rpages; /* total page number in rpages */ 1351 struct page **cpages; /* pages store compressed data in cluster */ 1352 unsigned int nr_cpages; /* total page number in cpages */ 1353 void *rbuf; /* virtual mapped address on rpages */ 1354 struct compress_data *cbuf; /* virtual mapped address on cpages */ 1355 size_t rlen; /* valid data length in rbuf */ 1356 size_t clen; /* valid data length in cbuf */ 1357 void *private; /* payload buffer for specified compression algorithm */ |
1358 void *private2; /* extra payload buffer */ |
|
1244}; 1245 1246/* compress context for write IO path */ 1247struct compress_io_ctx { 1248 u32 magic; /* magic number to indicate page is compressed */ 1249 struct inode *inode; /* inode the context belong to */ 1250 struct page **rpages; /* pages store raw data in cluster */ 1251 unsigned int nr_rpages; /* total page number in rpages */ --- 13 unchanged lines hidden (view full) --- 1265 unsigned int nr_cpages; /* total page number in cpages */ 1266 struct page **tpages; /* temp pages to pad holes in cluster */ 1267 void *rbuf; /* virtual mapped address on rpages */ 1268 struct compress_data *cbuf; /* virtual mapped address on cpages */ 1269 size_t rlen; /* valid data length in rbuf */ 1270 size_t clen; /* valid data length in cbuf */ 1271 refcount_t ref; /* referrence count of compressed page */ 1272 bool failed; /* indicate IO error during decompression */ | 1359}; 1360 1361/* compress context for write IO path */ 1362struct compress_io_ctx { 1363 u32 magic; /* magic number to indicate page is compressed */ 1364 struct inode *inode; /* inode the context belong to */ 1365 struct page **rpages; /* pages store raw data in cluster */ 1366 unsigned int nr_rpages; /* total page number in rpages */ --- 13 unchanged lines hidden (view full) --- 1380 unsigned int nr_cpages; /* total page number in cpages */ 1381 struct page **tpages; /* temp pages to pad holes in cluster */ 1382 void *rbuf; /* virtual mapped address on rpages */ 1383 struct compress_data *cbuf; /* virtual mapped address on cpages */ 1384 size_t rlen; /* valid data length in rbuf */ 1385 size_t clen; /* valid data length in cbuf */ 1386 refcount_t ref; /* referrence count of compressed page */ 1387 bool failed; /* indicate IO error during decompression */ |
1388 void *private; /* payload buffer for specified decompression algorithm */ 1389 void *private2; /* extra payload buffer */ |
|
1273}; 1274 1275#define NULL_CLUSTER ((unsigned int)(~0)) 1276#define MIN_COMPRESS_LOG_SIZE 2 1277#define MAX_COMPRESS_LOG_SIZE 8 | 1390}; 1391 1392#define NULL_CLUSTER ((unsigned int)(~0)) 1393#define MIN_COMPRESS_LOG_SIZE 2 1394#define MAX_COMPRESS_LOG_SIZE 8 |
1395#define MAX_COMPRESS_WINDOW_SIZE ((PAGE_SIZE) << MAX_COMPRESS_LOG_SIZE) |
|
1278 1279struct f2fs_sb_info { 1280 struct super_block *sb; /* pointer to VFS super block */ 1281 struct proc_dir_entry *s_proc; /* proc entry */ 1282 struct f2fs_super_block *raw_super; /* raw super block pointer */ 1283 struct rw_semaphore sb_lock; /* lock for raw super block */ 1284 int valid_super_block; /* valid super block no */ 1285 unsigned long s_flag; /* flags for sbi */ --- 66 unchanged lines hidden (view full) --- 1352 unsigned int root_ino_num; /* root inode number*/ 1353 unsigned int node_ino_num; /* node inode number*/ 1354 unsigned int meta_ino_num; /* meta inode number*/ 1355 unsigned int log_blocks_per_seg; /* log2 blocks per segment */ 1356 unsigned int blocks_per_seg; /* blocks per segment */ 1357 unsigned int segs_per_sec; /* segments per section */ 1358 unsigned int secs_per_zone; /* sections per zone */ 1359 unsigned int total_sections; /* total section count */ | 1396 1397struct f2fs_sb_info { 1398 struct super_block *sb; /* pointer to VFS super block */ 1399 struct proc_dir_entry *s_proc; /* proc entry */ 1400 struct f2fs_super_block *raw_super; /* raw super block pointer */ 1401 struct rw_semaphore sb_lock; /* lock for raw super block */ 1402 int valid_super_block; /* valid super block no */ 1403 unsigned long s_flag; /* flags for sbi */ --- 66 unchanged lines hidden (view full) --- 1470 unsigned int root_ino_num; /* root inode number*/ 1471 unsigned int node_ino_num; /* node inode number*/ 1472 unsigned int meta_ino_num; /* meta inode number*/ 1473 unsigned int log_blocks_per_seg; /* log2 blocks per segment */ 1474 unsigned int blocks_per_seg; /* blocks per segment */ 1475 unsigned int segs_per_sec; /* segments per section */ 1476 unsigned int secs_per_zone; /* sections per zone */ 1477 unsigned int total_sections; /* total section count */ |
1360 struct mutex resize_mutex; /* for resize exclusion */ | |
1361 unsigned int total_node_count; /* total node block count */ 1362 unsigned int total_valid_node_count; /* valid node block count */ 1363 loff_t max_file_blocks; /* max block index of file */ 1364 int dir_level; /* directory level */ 1365 int readdir_ra; /* readahead inode in readdir */ 1366 1367 block_t user_block_count; /* # of user blocks */ 1368 block_t total_valid_block_count; /* # of valid blocks */ --- 69 unchanged lines hidden (view full) --- 1438 unsigned int io_skip_bggc; /* skip background gc for in-flight IO */ 1439 unsigned int other_skip_bggc; /* skip background gc for other reasons */ 1440 unsigned int ndirty_inode[NR_INODE_TYPE]; /* # of dirty inodes */ 1441#endif 1442 spinlock_t stat_lock; /* lock for stat operations */ 1443 1444 /* For app/fs IO statistics */ 1445 spinlock_t iostat_lock; | 1478 unsigned int total_node_count; /* total node block count */ 1479 unsigned int total_valid_node_count; /* valid node block count */ 1480 loff_t max_file_blocks; /* max block index of file */ 1481 int dir_level; /* directory level */ 1482 int readdir_ra; /* readahead inode in readdir */ 1483 1484 block_t user_block_count; /* # of user blocks */ 1485 block_t total_valid_block_count; /* # of valid blocks */ --- 69 unchanged lines hidden (view full) --- 1555 unsigned int io_skip_bggc; /* skip background gc for in-flight IO */ 1556 unsigned int other_skip_bggc; /* skip background gc for other reasons */ 1557 unsigned int ndirty_inode[NR_INODE_TYPE]; /* # of dirty inodes */ 1558#endif 1559 spinlock_t stat_lock; /* lock for stat operations */ 1560 1561 /* For app/fs IO statistics */ 1562 spinlock_t iostat_lock; |
1446 unsigned long long write_iostat[NR_IO_TYPE]; | 1563 unsigned long long rw_iostat[NR_IO_TYPE]; 1564 unsigned long long prev_rw_iostat[NR_IO_TYPE]; |
1447 bool iostat_enable; | 1565 bool iostat_enable; |
1566 unsigned long iostat_next_period; 1567 unsigned int iostat_period_ms; |
|
1448 | 1568 |
1569 /* to attach REQ_META|REQ_FUA flags */ 1570 unsigned int data_io_flag; 1571 |
|
1449 /* For sysfs suppport */ 1450 struct kobject s_kobj; 1451 struct completion s_kobj_unregister; 1452 1453 /* For shrinker support */ 1454 struct list_head s_list; 1455 int s_ndevs; /* number of devices */ 1456 struct f2fs_dev_info *devs; /* for device list */ --- 8 unchanged lines hidden (view full) --- 1465 1466 /* Reference to checksum algorithm driver via cryptoapi */ 1467 struct crypto_shash *s_chksum_driver; 1468 1469 /* Precomputed FS UUID checksum for seeding other checksums */ 1470 __u32 s_chksum_seed; 1471 1472 struct workqueue_struct *post_read_wq; /* post read workqueue */ | 1572 /* For sysfs suppport */ 1573 struct kobject s_kobj; 1574 struct completion s_kobj_unregister; 1575 1576 /* For shrinker support */ 1577 struct list_head s_list; 1578 int s_ndevs; /* number of devices */ 1579 struct f2fs_dev_info *devs; /* for device list */ --- 8 unchanged lines hidden (view full) --- 1588 1589 /* Reference to checksum algorithm driver via cryptoapi */ 1590 struct crypto_shash *s_chksum_driver; 1591 1592 /* Precomputed FS UUID checksum for seeding other checksums */ 1593 __u32 s_chksum_seed; 1594 1595 struct workqueue_struct *post_read_wq; /* post read workqueue */ |
1596 1597 struct kmem_cache *inline_xattr_slab; /* inline xattr entry */ 1598 unsigned int inline_xattr_slab_size; /* default inline xattr slab size */ |
|
1473}; 1474 1475struct f2fs_private_dio { 1476 struct inode *inode; 1477 void *orig_private; 1478 bio_end_io_t *orig_end_io; 1479 bool write; 1480}; --- 724 unchanged lines hidden (view full) --- 2205 sbi->current_reserved_blocks++; 2206 2207 spin_unlock(&sbi->stat_lock); 2208 2209 if (is_inode) { 2210 dquot_free_inode(inode); 2211 } else { 2212 if (unlikely(inode->i_blocks == 0)) { | 1599}; 1600 1601struct f2fs_private_dio { 1602 struct inode *inode; 1603 void *orig_private; 1604 bio_end_io_t *orig_end_io; 1605 bool write; 1606}; --- 724 unchanged lines hidden (view full) --- 2331 sbi->current_reserved_blocks++; 2332 2333 spin_unlock(&sbi->stat_lock); 2334 2335 if (is_inode) { 2336 dquot_free_inode(inode); 2337 } else { 2338 if (unlikely(inode->i_blocks == 0)) { |
2213 f2fs_warn(sbi, "Inconsistent i_blocks, ino:%lu, iblocks:%llu", | 2339 f2fs_warn(sbi, "dec_valid_node_count: inconsistent i_blocks, ino:%lu, iblocks:%llu", |
2214 inode->i_ino, 2215 (unsigned long long)inode->i_blocks); 2216 set_sbi_flag(sbi, SBI_NEED_FSCK); 2217 return; 2218 } 2219 f2fs_i_blocks_write(inode, 1, false, true); 2220 } 2221} --- 151 unchanged lines hidden (view full) --- 2373} 2374 2375static inline __le32 *blkaddr_in_node(struct f2fs_node *node) 2376{ 2377 return RAW_IS_INODE(node) ? node->i.i_addr : node->dn.addr; 2378} 2379 2380static inline int f2fs_has_extra_attr(struct inode *inode); | 2340 inode->i_ino, 2341 (unsigned long long)inode->i_blocks); 2342 set_sbi_flag(sbi, SBI_NEED_FSCK); 2343 return; 2344 } 2345 f2fs_i_blocks_write(inode, 1, false, true); 2346 } 2347} --- 151 unchanged lines hidden (view full) --- 2499} 2500 2501static inline __le32 *blkaddr_in_node(struct f2fs_node *node) 2502{ 2503 return RAW_IS_INODE(node) ? node->i.i_addr : node->dn.addr; 2504} 2505 2506static inline int f2fs_has_extra_attr(struct inode *inode); |
2381static inline block_t datablock_addr(struct inode *inode, | 2507static inline block_t data_blkaddr(struct inode *inode, |
2382 struct page *node_page, unsigned int offset) 2383{ 2384 struct f2fs_node *raw_node; 2385 __le32 *addr_array; 2386 int base = 0; 2387 bool is_inode = IS_INODE(node_page); 2388 2389 raw_node = F2FS_NODE(node_page); 2390 | 2508 struct page *node_page, unsigned int offset) 2509{ 2510 struct f2fs_node *raw_node; 2511 __le32 *addr_array; 2512 int base = 0; 2513 bool is_inode = IS_INODE(node_page); 2514 2515 raw_node = F2FS_NODE(node_page); 2516 |
2391 /* from GC path only */ | |
2392 if (is_inode) { 2393 if (!inode) | 2517 if (is_inode) { 2518 if (!inode) |
2519 /* from GC path only */ |
|
2394 base = offset_in_addr(&raw_node->i); 2395 else if (f2fs_has_extra_attr(inode)) 2396 base = get_extra_isize(inode); 2397 } 2398 2399 addr_array = blkaddr_in_node(raw_node); 2400 return le32_to_cpu(addr_array[base + offset]); 2401} 2402 | 2520 base = offset_in_addr(&raw_node->i); 2521 else if (f2fs_has_extra_attr(inode)) 2522 base = get_extra_isize(inode); 2523 } 2524 2525 addr_array = blkaddr_in_node(raw_node); 2526 return le32_to_cpu(addr_array[base + offset]); 2527} 2528 |
2529static inline block_t f2fs_data_blkaddr(struct dnode_of_data *dn) 2530{ 2531 return data_blkaddr(dn->inode, dn->node_page, dn->ofs_in_node); 2532} 2533 |
|
2403static inline int f2fs_test_bit(unsigned int nr, char *addr) 2404{ 2405 int mask; 2406 2407 addr += (nr >> 3); 2408 mask = 1 << (7 - (nr & 0x07)); 2409 return mask & *addr; 2410} --- 81 unchanged lines hidden (view full) --- 2492 if (S_ISDIR(mode)) 2493 return flags; 2494 else if (S_ISREG(mode)) 2495 return flags & F2FS_REG_FLMASK; 2496 else 2497 return flags & F2FS_OTHER_FLMASK; 2498} 2499 | 2534static inline int f2fs_test_bit(unsigned int nr, char *addr) 2535{ 2536 int mask; 2537 2538 addr += (nr >> 3); 2539 mask = 1 << (7 - (nr & 0x07)); 2540 return mask & *addr; 2541} --- 81 unchanged lines hidden (view full) --- 2623 if (S_ISDIR(mode)) 2624 return flags; 2625 else if (S_ISREG(mode)) 2626 return flags & F2FS_REG_FLMASK; 2627 else 2628 return flags & F2FS_OTHER_FLMASK; 2629} 2630 |
2500/* used for f2fs_inode_info->flags */ 2501enum { 2502 FI_NEW_INODE, /* indicate newly allocated inode */ 2503 FI_DIRTY_INODE, /* indicate inode is dirty or not */ 2504 FI_AUTO_RECOVER, /* indicate inode is recoverable */ 2505 FI_DIRTY_DIR, /* indicate directory has dirty pages */ 2506 FI_INC_LINK, /* need to increment i_nlink */ 2507 FI_ACL_MODE, /* indicate acl mode */ 2508 FI_NO_ALLOC, /* should not allocate any blocks */ 2509 FI_FREE_NID, /* free allocated nide */ 2510 FI_NO_EXTENT, /* not to use the extent cache */ 2511 FI_INLINE_XATTR, /* used for inline xattr */ 2512 FI_INLINE_DATA, /* used for inline data*/ 2513 FI_INLINE_DENTRY, /* used for inline dentry */ 2514 FI_APPEND_WRITE, /* inode has appended data */ 2515 FI_UPDATE_WRITE, /* inode has in-place-update data */ 2516 FI_NEED_IPU, /* used for ipu per file */ 2517 FI_ATOMIC_FILE, /* indicate atomic file */ 2518 FI_ATOMIC_COMMIT, /* indicate the state of atomical committing */ 2519 FI_VOLATILE_FILE, /* indicate volatile file */ 2520 FI_FIRST_BLOCK_WRITTEN, /* indicate #0 data block was written */ 2521 FI_DROP_CACHE, /* drop dirty page cache */ 2522 FI_DATA_EXIST, /* indicate data exists */ 2523 FI_INLINE_DOTS, /* indicate inline dot dentries */ 2524 FI_DO_DEFRAG, /* indicate defragment is running */ 2525 FI_DIRTY_FILE, /* indicate regular/symlink has dirty pages */ 2526 FI_NO_PREALLOC, /* indicate skipped preallocated blocks */ 2527 FI_HOT_DATA, /* indicate file is hot */ 2528 FI_EXTRA_ATTR, /* indicate file has extra attribute */ 2529 FI_PROJ_INHERIT, /* indicate file inherits projectid */ 2530 FI_PIN_FILE, /* indicate file should not be gced */ 2531 FI_ATOMIC_REVOKE_REQUEST, /* request to drop atomic data */ 2532 FI_VERITY_IN_PROGRESS, /* building fs-verity Merkle tree */ 2533 FI_COMPRESSED_FILE, /* indicate file's data can be compressed */ 2534 FI_MMAP_FILE, /* indicate file was mmapped */ 2535}; 2536 | |
2537static inline void __mark_inode_dirty_flag(struct inode *inode, 2538 int flag, bool set) 2539{ 2540 switch (flag) { 2541 case FI_INLINE_XATTR: 2542 case FI_INLINE_DATA: 2543 case FI_INLINE_DENTRY: 2544 case FI_NEW_INODE: 2545 if (set) 2546 return; 2547 /* fall through */ 2548 case FI_DATA_EXIST: 2549 case FI_INLINE_DOTS: 2550 case FI_PIN_FILE: | 2631static inline void __mark_inode_dirty_flag(struct inode *inode, 2632 int flag, bool set) 2633{ 2634 switch (flag) { 2635 case FI_INLINE_XATTR: 2636 case FI_INLINE_DATA: 2637 case FI_INLINE_DENTRY: 2638 case FI_NEW_INODE: 2639 if (set) 2640 return; 2641 /* fall through */ 2642 case FI_DATA_EXIST: 2643 case FI_INLINE_DOTS: 2644 case FI_PIN_FILE: |
2551 case FI_COMPRESSED_FILE: | |
2552 f2fs_mark_inode_dirty_sync(inode, true); 2553 } 2554} 2555 2556static inline void set_inode_flag(struct inode *inode, int flag) 2557{ | 2645 f2fs_mark_inode_dirty_sync(inode, true); 2646 } 2647} 2648 2649static inline void set_inode_flag(struct inode *inode, int flag) 2650{ |
2558 if (!test_bit(flag, &F2FS_I(inode)->flags)) 2559 set_bit(flag, &F2FS_I(inode)->flags); | 2651 test_and_set_bit(flag, F2FS_I(inode)->flags); |
2560 __mark_inode_dirty_flag(inode, flag, true); 2561} 2562 2563static inline int is_inode_flag_set(struct inode *inode, int flag) 2564{ | 2652 __mark_inode_dirty_flag(inode, flag, true); 2653} 2654 2655static inline int is_inode_flag_set(struct inode *inode, int flag) 2656{ |
2565 return test_bit(flag, &F2FS_I(inode)->flags); | 2657 return test_bit(flag, F2FS_I(inode)->flags); |
2566} 2567 2568static inline void clear_inode_flag(struct inode *inode, int flag) 2569{ | 2658} 2659 2660static inline void clear_inode_flag(struct inode *inode, int flag) 2661{ |
2570 if (test_bit(flag, &F2FS_I(inode)->flags)) 2571 clear_bit(flag, &F2FS_I(inode)->flags); | 2662 test_and_clear_bit(flag, F2FS_I(inode)->flags); |
2572 __mark_inode_dirty_flag(inode, flag, false); 2573} 2574 2575static inline bool f2fs_verity_in_progress(struct inode *inode) 2576{ 2577 return IS_ENABLED(CONFIG_FS_VERITY) && 2578 is_inode_flag_set(inode, FI_VERITY_IN_PROGRESS); 2579} --- 74 unchanged lines hidden (view full) --- 2654 f2fs_mark_inode_dirty_sync(inode, true); 2655} 2656 2657static inline void get_inline_info(struct inode *inode, struct f2fs_inode *ri) 2658{ 2659 struct f2fs_inode_info *fi = F2FS_I(inode); 2660 2661 if (ri->i_inline & F2FS_INLINE_XATTR) | 2663 __mark_inode_dirty_flag(inode, flag, false); 2664} 2665 2666static inline bool f2fs_verity_in_progress(struct inode *inode) 2667{ 2668 return IS_ENABLED(CONFIG_FS_VERITY) && 2669 is_inode_flag_set(inode, FI_VERITY_IN_PROGRESS); 2670} --- 74 unchanged lines hidden (view full) --- 2745 f2fs_mark_inode_dirty_sync(inode, true); 2746} 2747 2748static inline void get_inline_info(struct inode *inode, struct f2fs_inode *ri) 2749{ 2750 struct f2fs_inode_info *fi = F2FS_I(inode); 2751 2752 if (ri->i_inline & F2FS_INLINE_XATTR) |
2662 set_bit(FI_INLINE_XATTR, &fi->flags); | 2753 set_bit(FI_INLINE_XATTR, fi->flags); |
2663 if (ri->i_inline & F2FS_INLINE_DATA) | 2754 if (ri->i_inline & F2FS_INLINE_DATA) |
2664 set_bit(FI_INLINE_DATA, &fi->flags); | 2755 set_bit(FI_INLINE_DATA, fi->flags); |
2665 if (ri->i_inline & F2FS_INLINE_DENTRY) | 2756 if (ri->i_inline & F2FS_INLINE_DENTRY) |
2666 set_bit(FI_INLINE_DENTRY, &fi->flags); | 2757 set_bit(FI_INLINE_DENTRY, fi->flags); |
2667 if (ri->i_inline & F2FS_DATA_EXIST) | 2758 if (ri->i_inline & F2FS_DATA_EXIST) |
2668 set_bit(FI_DATA_EXIST, &fi->flags); | 2759 set_bit(FI_DATA_EXIST, fi->flags); |
2669 if (ri->i_inline & F2FS_INLINE_DOTS) | 2760 if (ri->i_inline & F2FS_INLINE_DOTS) |
2670 set_bit(FI_INLINE_DOTS, &fi->flags); | 2761 set_bit(FI_INLINE_DOTS, fi->flags); |
2671 if (ri->i_inline & F2FS_EXTRA_ATTR) | 2762 if (ri->i_inline & F2FS_EXTRA_ATTR) |
2672 set_bit(FI_EXTRA_ATTR, &fi->flags); | 2763 set_bit(FI_EXTRA_ATTR, fi->flags); |
2673 if (ri->i_inline & F2FS_PIN_FILE) | 2764 if (ri->i_inline & F2FS_PIN_FILE) |
2674 set_bit(FI_PIN_FILE, &fi->flags); | 2765 set_bit(FI_PIN_FILE, fi->flags); |
2675} 2676 2677static inline void set_raw_inline(struct inode *inode, struct f2fs_inode *ri) 2678{ 2679 ri->i_inline = 0; 2680 2681 if (is_inode_flag_set(inode, FI_INLINE_XATTR)) 2682 ri->i_inline |= F2FS_INLINE_XATTR; --- 168 unchanged lines hidden (view full) --- 2851 if (!is_inode_flag_set(inode, FI_AUTO_RECOVER) || 2852 file_keep_isize(inode) || 2853 i_size_read(inode) & ~PAGE_MASK) 2854 return false; 2855 2856 if (!f2fs_is_time_consistent(inode)) 2857 return false; 2858 | 2766} 2767 2768static inline void set_raw_inline(struct inode *inode, struct f2fs_inode *ri) 2769{ 2770 ri->i_inline = 0; 2771 2772 if (is_inode_flag_set(inode, FI_INLINE_XATTR)) 2773 ri->i_inline |= F2FS_INLINE_XATTR; --- 168 unchanged lines hidden (view full) --- 2942 if (!is_inode_flag_set(inode, FI_AUTO_RECOVER) || 2943 file_keep_isize(inode) || 2944 i_size_read(inode) & ~PAGE_MASK) 2945 return false; 2946 2947 if (!f2fs_is_time_consistent(inode)) 2948 return false; 2949 |
2859 down_read(&F2FS_I(inode)->i_sem); | 2950 spin_lock(&F2FS_I(inode)->i_size_lock); |
2860 ret = F2FS_I(inode)->last_disk_size == i_size_read(inode); | 2951 ret = F2FS_I(inode)->last_disk_size == i_size_read(inode); |
2861 up_read(&F2FS_I(inode)->i_sem); | 2952 spin_unlock(&F2FS_I(inode)->i_size_lock); |
2862 2863 return ret; 2864} 2865 2866static inline bool f2fs_readonly(struct super_block *sb) 2867{ 2868 return sb_rdonly(sb); 2869} 2870 2871static inline bool f2fs_cp_error(struct f2fs_sb_info *sbi) 2872{ 2873 return is_set_ckpt_flags(sbi, CP_ERROR_FLAG); 2874} 2875 | 2953 2954 return ret; 2955} 2956 2957static inline bool f2fs_readonly(struct super_block *sb) 2958{ 2959 return sb_rdonly(sb); 2960} 2961 2962static inline bool f2fs_cp_error(struct f2fs_sb_info *sbi) 2963{ 2964 return is_set_ckpt_flags(sbi, CP_ERROR_FLAG); 2965} 2966 |
2876static inline bool is_dot_dotdot(const struct qstr *str) | 2967static inline bool is_dot_dotdot(const u8 *name, size_t len) |
2877{ | 2968{ |
2878 if (str->len == 1 && str->name[0] == '.') | 2969 if (len == 1 && name[0] == '.') |
2879 return true; 2880 | 2970 return true; 2971 |
2881 if (str->len == 2 && str->name[0] == '.' && str->name[1] == '.') | 2972 if (len == 2 && name[0] == '.' && name[1] == '.') |
2882 return true; 2883 2884 return false; 2885} 2886 2887static inline bool f2fs_may_extent_tree(struct inode *inode) 2888{ 2889 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); --- 11 unchanged lines hidden (view full) --- 2901 return false; 2902 2903 return S_ISREG(inode->i_mode); 2904} 2905 2906static inline void *f2fs_kmalloc(struct f2fs_sb_info *sbi, 2907 size_t size, gfp_t flags) 2908{ | 2973 return true; 2974 2975 return false; 2976} 2977 2978static inline bool f2fs_may_extent_tree(struct inode *inode) 2979{ 2980 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); --- 11 unchanged lines hidden (view full) --- 2992 return false; 2993 2994 return S_ISREG(inode->i_mode); 2995} 2996 2997static inline void *f2fs_kmalloc(struct f2fs_sb_info *sbi, 2998 size_t size, gfp_t flags) 2999{ |
2909 void *ret; 2910 | |
2911 if (time_to_inject(sbi, FAULT_KMALLOC)) { 2912 f2fs_show_injection_info(sbi, FAULT_KMALLOC); 2913 return NULL; 2914 } 2915 | 3000 if (time_to_inject(sbi, FAULT_KMALLOC)) { 3001 f2fs_show_injection_info(sbi, FAULT_KMALLOC); 3002 return NULL; 3003 } 3004 |
2916 ret = kmalloc(size, flags); 2917 if (ret) 2918 return ret; 2919 2920 return kvmalloc(size, flags); | 3005 return kmalloc(size, flags); |
2921} 2922 2923static inline void *f2fs_kzalloc(struct f2fs_sb_info *sbi, 2924 size_t size, gfp_t flags) 2925{ 2926 return f2fs_kmalloc(sbi, size, flags | __GFP_ZERO); 2927} 2928 --- 33 unchanged lines hidden (view full) --- 2962 offsetof(struct f2fs_inode, i_extra_isize)) \ 2963 2964#define F2FS_OLD_ATTRIBUTE_SIZE (offsetof(struct f2fs_inode, i_addr)) 2965#define F2FS_FITS_IN_INODE(f2fs_inode, extra_isize, field) \ 2966 ((offsetof(typeof(*(f2fs_inode)), field) + \ 2967 sizeof((f2fs_inode)->field)) \ 2968 <= (F2FS_OLD_ATTRIBUTE_SIZE + (extra_isize))) \ 2969 | 3006} 3007 3008static inline void *f2fs_kzalloc(struct f2fs_sb_info *sbi, 3009 size_t size, gfp_t flags) 3010{ 3011 return f2fs_kmalloc(sbi, size, flags | __GFP_ZERO); 3012} 3013 --- 33 unchanged lines hidden (view full) --- 3047 offsetof(struct f2fs_inode, i_extra_isize)) \ 3048 3049#define F2FS_OLD_ATTRIBUTE_SIZE (offsetof(struct f2fs_inode, i_addr)) 3050#define F2FS_FITS_IN_INODE(f2fs_inode, extra_isize, field) \ 3051 ((offsetof(typeof(*(f2fs_inode)), field) + \ 3052 sizeof((f2fs_inode)->field)) \ 3053 <= (F2FS_OLD_ATTRIBUTE_SIZE + (extra_isize))) \ 3054 |
3055#define DEFAULT_IOSTAT_PERIOD_MS 3000 3056#define MIN_IOSTAT_PERIOD_MS 100 3057/* maximum period of iostat tracing is 1 day */ 3058#define MAX_IOSTAT_PERIOD_MS 8640000 3059 |
|
2970static inline void f2fs_reset_iostat(struct f2fs_sb_info *sbi) 2971{ 2972 int i; 2973 2974 spin_lock(&sbi->iostat_lock); | 3060static inline void f2fs_reset_iostat(struct f2fs_sb_info *sbi) 3061{ 3062 int i; 3063 3064 spin_lock(&sbi->iostat_lock); |
2975 for (i = 0; i < NR_IO_TYPE; i++) 2976 sbi->write_iostat[i] = 0; | 3065 for (i = 0; i < NR_IO_TYPE; i++) { 3066 sbi->rw_iostat[i] = 0; 3067 sbi->prev_rw_iostat[i] = 0; 3068 } |
2977 spin_unlock(&sbi->iostat_lock); 2978} 2979 | 3069 spin_unlock(&sbi->iostat_lock); 3070} 3071 |
3072extern void f2fs_record_iostat(struct f2fs_sb_info *sbi); 3073 |
|
2980static inline void f2fs_update_iostat(struct f2fs_sb_info *sbi, 2981 enum iostat_type type, unsigned long long io_bytes) 2982{ 2983 if (!sbi->iostat_enable) 2984 return; 2985 spin_lock(&sbi->iostat_lock); | 3074static inline void f2fs_update_iostat(struct f2fs_sb_info *sbi, 3075 enum iostat_type type, unsigned long long io_bytes) 3076{ 3077 if (!sbi->iostat_enable) 3078 return; 3079 spin_lock(&sbi->iostat_lock); |
2986 sbi->write_iostat[type] += io_bytes; | 3080 sbi->rw_iostat[type] += io_bytes; |
2987 2988 if (type == APP_WRITE_IO || type == APP_DIRECT_IO) | 3081 3082 if (type == APP_WRITE_IO || type == APP_DIRECT_IO) |
2989 sbi->write_iostat[APP_BUFFERED_IO] = 2990 sbi->write_iostat[APP_WRITE_IO] - 2991 sbi->write_iostat[APP_DIRECT_IO]; | 3083 sbi->rw_iostat[APP_BUFFERED_IO] = 3084 sbi->rw_iostat[APP_WRITE_IO] - 3085 sbi->rw_iostat[APP_DIRECT_IO]; 3086 3087 if (type == APP_READ_IO || type == APP_DIRECT_READ_IO) 3088 sbi->rw_iostat[APP_BUFFERED_READ_IO] = 3089 sbi->rw_iostat[APP_READ_IO] - 3090 sbi->rw_iostat[APP_DIRECT_READ_IO]; |
2992 spin_unlock(&sbi->iostat_lock); | 3091 spin_unlock(&sbi->iostat_lock); |
3092 3093 f2fs_record_iostat(sbi); |
|
2993} 2994 2995#define __is_large_section(sbi) ((sbi)->segs_per_sec > 1) 2996 2997#define __is_meta_io(fio) (PAGE_TYPE_OF_BIO((fio)->type) == META) 2998 2999bool f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi, 3000 block_t blkaddr, int type); --- 36 unchanged lines hidden (view full) --- 3037 f2fs_put_page(page, 0); 3038} 3039 3040/* 3041 * file.c 3042 */ 3043int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync); 3044void f2fs_truncate_data_blocks(struct dnode_of_data *dn); | 3094} 3095 3096#define __is_large_section(sbi) ((sbi)->segs_per_sec > 1) 3097 3098#define __is_meta_io(fio) (PAGE_TYPE_OF_BIO((fio)->type) == META) 3099 3100bool f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi, 3101 block_t blkaddr, int type); --- 36 unchanged lines hidden (view full) --- 3138 f2fs_put_page(page, 0); 3139} 3140 3141/* 3142 * file.c 3143 */ 3144int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync); 3145void f2fs_truncate_data_blocks(struct dnode_of_data *dn); |
3146int f2fs_do_truncate_blocks(struct inode *inode, u64 from, bool lock); |
|
3045int f2fs_truncate_blocks(struct inode *inode, u64 from, bool lock); 3046int f2fs_truncate(struct inode *inode); 3047int f2fs_getattr(const struct path *path, struct kstat *stat, 3048 u32 request_mask, unsigned int flags); 3049int f2fs_setattr(struct dentry *dentry, struct iattr *attr); 3050int f2fs_truncate_hole(struct inode *inode, pgoff_t pg_start, pgoff_t pg_end); 3051void f2fs_truncate_data_blocks_range(struct dnode_of_data *dn, int count); 3052int f2fs_precache_extents(struct inode *inode); --- 19 unchanged lines hidden (view full) --- 3072 3073/* 3074 * namei.c 3075 */ 3076int f2fs_update_extension_list(struct f2fs_sb_info *sbi, const char *name, 3077 bool hot, bool set); 3078struct dentry *f2fs_get_parent(struct dentry *child); 3079 | 3147int f2fs_truncate_blocks(struct inode *inode, u64 from, bool lock); 3148int f2fs_truncate(struct inode *inode); 3149int f2fs_getattr(const struct path *path, struct kstat *stat, 3150 u32 request_mask, unsigned int flags); 3151int f2fs_setattr(struct dentry *dentry, struct iattr *attr); 3152int f2fs_truncate_hole(struct inode *inode, pgoff_t pg_start, pgoff_t pg_end); 3153void f2fs_truncate_data_blocks_range(struct dnode_of_data *dn, int count); 3154int f2fs_precache_extents(struct inode *inode); --- 19 unchanged lines hidden (view full) --- 3174 3175/* 3176 * namei.c 3177 */ 3178int f2fs_update_extension_list(struct f2fs_sb_info *sbi, const char *name, 3179 bool hot, bool set); 3180struct dentry *f2fs_get_parent(struct dentry *child); 3181 |
3080extern int f2fs_ci_compare(const struct inode *parent, 3081 const struct qstr *name, 3082 const struct qstr *entry, 3083 bool quick); 3084 | |
3085/* 3086 * dir.c 3087 */ 3088unsigned char f2fs_get_de_type(struct f2fs_dir_entry *de); | 3182/* 3183 * dir.c 3184 */ 3185unsigned char f2fs_get_de_type(struct f2fs_dir_entry *de); |
3089struct f2fs_dir_entry *f2fs_find_target_dentry(struct fscrypt_name *fname, 3090 f2fs_hash_t namehash, int *max_slots, 3091 struct f2fs_dentry_ptr *d); | 3186int f2fs_init_casefolded_name(const struct inode *dir, 3187 struct f2fs_filename *fname); 3188int f2fs_setup_filename(struct inode *dir, const struct qstr *iname, 3189 int lookup, struct f2fs_filename *fname); 3190int f2fs_prepare_lookup(struct inode *dir, struct dentry *dentry, 3191 struct f2fs_filename *fname); 3192void f2fs_free_filename(struct f2fs_filename *fname); 3193struct f2fs_dir_entry *f2fs_find_target_dentry(const struct f2fs_dentry_ptr *d, 3194 const struct f2fs_filename *fname, int *max_slots); |
3092int f2fs_fill_dentries(struct dir_context *ctx, struct f2fs_dentry_ptr *d, 3093 unsigned int start_pos, struct fscrypt_str *fstr); 3094void f2fs_do_make_empty_dir(struct inode *inode, struct inode *parent, 3095 struct f2fs_dentry_ptr *d); 3096struct page *f2fs_init_inode_metadata(struct inode *inode, struct inode *dir, | 3195int f2fs_fill_dentries(struct dir_context *ctx, struct f2fs_dentry_ptr *d, 3196 unsigned int start_pos, struct fscrypt_str *fstr); 3197void f2fs_do_make_empty_dir(struct inode *inode, struct inode *parent, 3198 struct f2fs_dentry_ptr *d); 3199struct page *f2fs_init_inode_metadata(struct inode *inode, struct inode *dir, |
3097 const struct qstr *new_name, 3098 const struct qstr *orig_name, struct page *dpage); | 3200 const struct f2fs_filename *fname, struct page *dpage); |
3099void f2fs_update_parent_metadata(struct inode *dir, struct inode *inode, 3100 unsigned int current_depth); 3101int f2fs_room_for_filename(const void *bitmap, int slots, int max_slots); 3102void f2fs_drop_nlink(struct inode *dir, struct inode *inode); 3103struct f2fs_dir_entry *__f2fs_find_entry(struct inode *dir, | 3201void f2fs_update_parent_metadata(struct inode *dir, struct inode *inode, 3202 unsigned int current_depth); 3203int f2fs_room_for_filename(const void *bitmap, int slots, int max_slots); 3204void f2fs_drop_nlink(struct inode *dir, struct inode *inode); 3205struct f2fs_dir_entry *__f2fs_find_entry(struct inode *dir, |
3104 struct fscrypt_name *fname, struct page **res_page); | 3206 const struct f2fs_filename *fname, 3207 struct page **res_page); |
3105struct f2fs_dir_entry *f2fs_find_entry(struct inode *dir, 3106 const struct qstr *child, struct page **res_page); 3107struct f2fs_dir_entry *f2fs_parent_dir(struct inode *dir, struct page **p); 3108ino_t f2fs_inode_by_name(struct inode *dir, const struct qstr *qstr, 3109 struct page **page); 3110void f2fs_set_link(struct inode *dir, struct f2fs_dir_entry *de, 3111 struct page *page, struct inode *inode); 3112bool f2fs_has_enough_room(struct inode *dir, struct page *ipage, | 3208struct f2fs_dir_entry *f2fs_find_entry(struct inode *dir, 3209 const struct qstr *child, struct page **res_page); 3210struct f2fs_dir_entry *f2fs_parent_dir(struct inode *dir, struct page **p); 3211ino_t f2fs_inode_by_name(struct inode *dir, const struct qstr *qstr, 3212 struct page **page); 3213void f2fs_set_link(struct inode *dir, struct f2fs_dir_entry *de, 3214 struct page *page, struct inode *inode); 3215bool f2fs_has_enough_room(struct inode *dir, struct page *ipage, |
3113 struct fscrypt_name *fname); | 3216 const struct f2fs_filename *fname); |
3114void f2fs_update_dentry(nid_t ino, umode_t mode, struct f2fs_dentry_ptr *d, | 3217void f2fs_update_dentry(nid_t ino, umode_t mode, struct f2fs_dentry_ptr *d, |
3115 const struct qstr *name, f2fs_hash_t name_hash, | 3218 const struct fscrypt_str *name, f2fs_hash_t name_hash, |
3116 unsigned int bit_pos); | 3219 unsigned int bit_pos); |
3117int f2fs_add_regular_entry(struct inode *dir, const struct qstr *new_name, 3118 const struct qstr *orig_name, | 3220int f2fs_add_regular_entry(struct inode *dir, const struct f2fs_filename *fname, |
3119 struct inode *inode, nid_t ino, umode_t mode); | 3221 struct inode *inode, nid_t ino, umode_t mode); |
3120int f2fs_add_dentry(struct inode *dir, struct fscrypt_name *fname, | 3222int f2fs_add_dentry(struct inode *dir, const struct f2fs_filename *fname, |
3121 struct inode *inode, nid_t ino, umode_t mode); 3122int f2fs_do_add_link(struct inode *dir, const struct qstr *name, 3123 struct inode *inode, nid_t ino, umode_t mode); 3124void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page, 3125 struct inode *dir, struct inode *inode); 3126int f2fs_do_tmpfile(struct inode *inode, struct inode *dir); 3127bool f2fs_empty_dir(struct inode *dir); 3128 --- 13 unchanged lines hidden (view full) --- 3142void f2fs_quota_off_umount(struct super_block *sb); 3143int f2fs_commit_super(struct f2fs_sb_info *sbi, bool recover); 3144int f2fs_sync_fs(struct super_block *sb, int sync); 3145int f2fs_sanity_check_ckpt(struct f2fs_sb_info *sbi); 3146 3147/* 3148 * hash.c 3149 */ | 3223 struct inode *inode, nid_t ino, umode_t mode); 3224int f2fs_do_add_link(struct inode *dir, const struct qstr *name, 3225 struct inode *inode, nid_t ino, umode_t mode); 3226void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page, 3227 struct inode *dir, struct inode *inode); 3228int f2fs_do_tmpfile(struct inode *inode, struct inode *dir); 3229bool f2fs_empty_dir(struct inode *dir); 3230 --- 13 unchanged lines hidden (view full) --- 3244void f2fs_quota_off_umount(struct super_block *sb); 3245int f2fs_commit_super(struct f2fs_sb_info *sbi, bool recover); 3246int f2fs_sync_fs(struct super_block *sb, int sync); 3247int f2fs_sanity_check_ckpt(struct f2fs_sb_info *sbi); 3248 3249/* 3250 * hash.c 3251 */ |
3150f2fs_hash_t f2fs_dentry_hash(const struct inode *dir, 3151 const struct qstr *name_info, struct fscrypt_name *fname); | 3252void f2fs_hash_filename(const struct inode *dir, struct f2fs_filename *fname); |
3152 3153/* 3154 * node.c 3155 */ 3156struct dnode_of_data; 3157struct node_info; 3158 3159int f2fs_check_nid_range(struct f2fs_sb_info *sbi, nid_t nid); --- 15 unchanged lines hidden (view full) --- 3175 unsigned int seq_id); 3176int f2fs_remove_inode_page(struct inode *inode); 3177struct page *f2fs_new_inode_page(struct inode *inode); 3178struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs); 3179void f2fs_ra_node_page(struct f2fs_sb_info *sbi, nid_t nid); 3180struct page *f2fs_get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid); 3181struct page *f2fs_get_node_page_ra(struct page *parent, int start); 3182int f2fs_move_node_page(struct page *node_page, int gc_type); | 3253 3254/* 3255 * node.c 3256 */ 3257struct dnode_of_data; 3258struct node_info; 3259 3260int f2fs_check_nid_range(struct f2fs_sb_info *sbi, nid_t nid); --- 15 unchanged lines hidden (view full) --- 3276 unsigned int seq_id); 3277int f2fs_remove_inode_page(struct inode *inode); 3278struct page *f2fs_new_inode_page(struct inode *inode); 3279struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs); 3280void f2fs_ra_node_page(struct f2fs_sb_info *sbi, nid_t nid); 3281struct page *f2fs_get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid); 3282struct page *f2fs_get_node_page_ra(struct page *parent, int start); 3283int f2fs_move_node_page(struct page *node_page, int gc_type); |
3284int f2fs_flush_inline_data(struct f2fs_sb_info *sbi); |
|
3183int f2fs_fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode, 3184 struct writeback_control *wbc, bool atomic, 3185 unsigned int *seq_id); 3186int f2fs_sync_node_pages(struct f2fs_sb_info *sbi, 3187 struct writeback_control *wbc, 3188 bool do_balance, enum iostat_type io_type); 3189int f2fs_build_free_nids(struct f2fs_sb_info *sbi, bool sync, bool mount); 3190bool f2fs_alloc_nid(struct f2fs_sb_info *sbi, nid_t *nid); --- 16 unchanged lines hidden (view full) --- 3207 */ 3208bool f2fs_need_SSR(struct f2fs_sb_info *sbi); 3209void f2fs_register_inmem_page(struct inode *inode, struct page *page); 3210void f2fs_drop_inmem_pages_all(struct f2fs_sb_info *sbi, bool gc_failure); 3211void f2fs_drop_inmem_pages(struct inode *inode); 3212void f2fs_drop_inmem_page(struct inode *inode, struct page *page); 3213int f2fs_commit_inmem_pages(struct inode *inode); 3214void f2fs_balance_fs(struct f2fs_sb_info *sbi, bool need); | 3285int f2fs_fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode, 3286 struct writeback_control *wbc, bool atomic, 3287 unsigned int *seq_id); 3288int f2fs_sync_node_pages(struct f2fs_sb_info *sbi, 3289 struct writeback_control *wbc, 3290 bool do_balance, enum iostat_type io_type); 3291int f2fs_build_free_nids(struct f2fs_sb_info *sbi, bool sync, bool mount); 3292bool f2fs_alloc_nid(struct f2fs_sb_info *sbi, nid_t *nid); --- 16 unchanged lines hidden (view full) --- 3309 */ 3310bool f2fs_need_SSR(struct f2fs_sb_info *sbi); 3311void f2fs_register_inmem_page(struct inode *inode, struct page *page); 3312void f2fs_drop_inmem_pages_all(struct f2fs_sb_info *sbi, bool gc_failure); 3313void f2fs_drop_inmem_pages(struct inode *inode); 3314void f2fs_drop_inmem_page(struct inode *inode, struct page *page); 3315int f2fs_commit_inmem_pages(struct inode *inode); 3316void f2fs_balance_fs(struct f2fs_sb_info *sbi, bool need); |
3215void f2fs_balance_fs_bg(struct f2fs_sb_info *sbi); | 3317void f2fs_balance_fs_bg(struct f2fs_sb_info *sbi, bool from_bg); |
3216int f2fs_issue_flush(struct f2fs_sb_info *sbi, nid_t ino); 3217int f2fs_create_flush_cmd_control(struct f2fs_sb_info *sbi); 3218int f2fs_flush_device_cache(struct f2fs_sb_info *sbi); 3219void f2fs_destroy_flush_cmd_control(struct f2fs_sb_info *sbi, bool free); 3220void f2fs_invalidate_blocks(struct f2fs_sb_info *sbi, block_t addr); 3221bool f2fs_is_checkpointed_data(struct f2fs_sb_info *sbi, block_t blkaddr); 3222void f2fs_drop_discard_cmd(struct f2fs_sb_info *sbi); 3223void f2fs_stop_discard_thread(struct f2fs_sb_info *sbi); --- 79 unchanged lines hidden (view full) --- 3303void f2fs_release_orphan_inode(struct f2fs_sb_info *sbi); 3304void f2fs_add_orphan_inode(struct inode *inode); 3305void f2fs_remove_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino); 3306int f2fs_recover_orphan_inodes(struct f2fs_sb_info *sbi); 3307int f2fs_get_valid_checkpoint(struct f2fs_sb_info *sbi); 3308void f2fs_update_dirty_page(struct inode *inode, struct page *page); 3309void f2fs_remove_dirty_inode(struct inode *inode); 3310int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type); | 3318int f2fs_issue_flush(struct f2fs_sb_info *sbi, nid_t ino); 3319int f2fs_create_flush_cmd_control(struct f2fs_sb_info *sbi); 3320int f2fs_flush_device_cache(struct f2fs_sb_info *sbi); 3321void f2fs_destroy_flush_cmd_control(struct f2fs_sb_info *sbi, bool free); 3322void f2fs_invalidate_blocks(struct f2fs_sb_info *sbi, block_t addr); 3323bool f2fs_is_checkpointed_data(struct f2fs_sb_info *sbi, block_t blkaddr); 3324void f2fs_drop_discard_cmd(struct f2fs_sb_info *sbi); 3325void f2fs_stop_discard_thread(struct f2fs_sb_info *sbi); --- 79 unchanged lines hidden (view full) --- 3405void f2fs_release_orphan_inode(struct f2fs_sb_info *sbi); 3406void f2fs_add_orphan_inode(struct inode *inode); 3407void f2fs_remove_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino); 3408int f2fs_recover_orphan_inodes(struct f2fs_sb_info *sbi); 3409int f2fs_get_valid_checkpoint(struct f2fs_sb_info *sbi); 3410void f2fs_update_dirty_page(struct inode *inode, struct page *page); 3411void f2fs_remove_dirty_inode(struct inode *inode); 3412int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type); |
3311void f2fs_wait_on_all_pages_writeback(struct f2fs_sb_info *sbi); | 3413void f2fs_wait_on_all_pages(struct f2fs_sb_info *sbi, int type); |
3312int f2fs_write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc); 3313void f2fs_init_ino_entry_info(struct f2fs_sb_info *sbi); 3314int __init f2fs_create_checkpoint_caches(void); 3315void f2fs_destroy_checkpoint_caches(void); 3316 3317/* 3318 * data.c 3319 */ 3320int __init f2fs_init_bioset(void); 3321void f2fs_destroy_bioset(void); | 3414int f2fs_write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc); 3415void f2fs_init_ino_entry_info(struct f2fs_sb_info *sbi); 3416int __init f2fs_create_checkpoint_caches(void); 3417void f2fs_destroy_checkpoint_caches(void); 3418 3419/* 3420 * data.c 3421 */ 3422int __init f2fs_init_bioset(void); 3423void f2fs_destroy_bioset(void); |
3322struct bio *f2fs_bio_alloc(struct f2fs_sb_info *sbi, int npages, bool no_fail); | 3424struct bio *f2fs_bio_alloc(struct f2fs_sb_info *sbi, int npages, bool noio); |
3323int f2fs_init_bio_entry_cache(void); 3324void f2fs_destroy_bio_entry_cache(void); 3325void f2fs_submit_bio(struct f2fs_sb_info *sbi, 3326 struct bio *bio, enum page_type type); 3327void f2fs_submit_merged_write(struct f2fs_sb_info *sbi, enum page_type type); 3328void f2fs_submit_merged_write_cond(struct f2fs_sb_info *sbi, 3329 struct inode *inode, struct page *page, 3330 nid_t ino, enum page_type type); --- 290 unchanged lines hidden (view full) --- 3621#define stat_inc_tot_blk_count(si, blks) do { } while (0) 3622#define stat_inc_data_blk_count(sbi, blks, gc_type) do { } while (0) 3623#define stat_inc_node_blk_count(sbi, blks, gc_type) do { } while (0) 3624 3625static inline int f2fs_build_stats(struct f2fs_sb_info *sbi) { return 0; } 3626static inline void f2fs_destroy_stats(struct f2fs_sb_info *sbi) { } 3627static inline void __init f2fs_create_root_stats(void) { } 3628static inline void f2fs_destroy_root_stats(void) { } | 3425int f2fs_init_bio_entry_cache(void); 3426void f2fs_destroy_bio_entry_cache(void); 3427void f2fs_submit_bio(struct f2fs_sb_info *sbi, 3428 struct bio *bio, enum page_type type); 3429void f2fs_submit_merged_write(struct f2fs_sb_info *sbi, enum page_type type); 3430void f2fs_submit_merged_write_cond(struct f2fs_sb_info *sbi, 3431 struct inode *inode, struct page *page, 3432 nid_t ino, enum page_type type); --- 290 unchanged lines hidden (view full) --- 3723#define stat_inc_tot_blk_count(si, blks) do { } while (0) 3724#define stat_inc_data_blk_count(sbi, blks, gc_type) do { } while (0) 3725#define stat_inc_node_blk_count(sbi, blks, gc_type) do { } while (0) 3726 3727static inline int f2fs_build_stats(struct f2fs_sb_info *sbi) { return 0; } 3728static inline void f2fs_destroy_stats(struct f2fs_sb_info *sbi) { } 3729static inline void __init f2fs_create_root_stats(void) { } 3730static inline void f2fs_destroy_root_stats(void) { } |
3629static inline void update_sit_info(struct f2fs_sb_info *sbi) {} | 3731static inline void f2fs_update_sit_info(struct f2fs_sb_info *sbi) {} |
3630#endif 3631 3632extern const struct file_operations f2fs_dir_operations; 3633#ifdef CONFIG_UNICODE 3634extern const struct dentry_operations f2fs_dentry_ops; 3635#endif 3636extern const struct file_operations f2fs_file_operations; 3637extern const struct inode_operations f2fs_file_inode_operations; --- 16 unchanged lines hidden (view full) --- 3654 struct page *ipage, u64 from); 3655int f2fs_read_inline_data(struct inode *inode, struct page *page); 3656int f2fs_convert_inline_page(struct dnode_of_data *dn, struct page *page); 3657int f2fs_convert_inline_inode(struct inode *inode); 3658int f2fs_try_convert_inline_dir(struct inode *dir, struct dentry *dentry); 3659int f2fs_write_inline_data(struct inode *inode, struct page *page); 3660bool f2fs_recover_inline_data(struct inode *inode, struct page *npage); 3661struct f2fs_dir_entry *f2fs_find_in_inline_dir(struct inode *dir, | 3732#endif 3733 3734extern const struct file_operations f2fs_dir_operations; 3735#ifdef CONFIG_UNICODE 3736extern const struct dentry_operations f2fs_dentry_ops; 3737#endif 3738extern const struct file_operations f2fs_file_operations; 3739extern const struct inode_operations f2fs_file_inode_operations; --- 16 unchanged lines hidden (view full) --- 3756 struct page *ipage, u64 from); 3757int f2fs_read_inline_data(struct inode *inode, struct page *page); 3758int f2fs_convert_inline_page(struct dnode_of_data *dn, struct page *page); 3759int f2fs_convert_inline_inode(struct inode *inode); 3760int f2fs_try_convert_inline_dir(struct inode *dir, struct dentry *dentry); 3761int f2fs_write_inline_data(struct inode *inode, struct page *page); 3762bool f2fs_recover_inline_data(struct inode *inode, struct page *npage); 3763struct f2fs_dir_entry *f2fs_find_in_inline_dir(struct inode *dir, |
3662 struct fscrypt_name *fname, struct page **res_page); | 3764 const struct f2fs_filename *fname, 3765 struct page **res_page); |
3663int f2fs_make_empty_inline_dir(struct inode *inode, struct inode *parent, 3664 struct page *ipage); | 3766int f2fs_make_empty_inline_dir(struct inode *inode, struct inode *parent, 3767 struct page *ipage); |
3665int f2fs_add_inline_entry(struct inode *dir, const struct qstr *new_name, 3666 const struct qstr *orig_name, | 3768int f2fs_add_inline_entry(struct inode *dir, const struct f2fs_filename *fname, |
3667 struct inode *inode, nid_t ino, umode_t mode); 3668void f2fs_delete_inline_entry(struct f2fs_dir_entry *dentry, 3669 struct page *page, struct inode *dir, 3670 struct inode *inode); 3671bool f2fs_empty_inline_dir(struct inode *dir); 3672int f2fs_read_inline_dir(struct file *file, struct dir_context *ctx, 3673 struct fscrypt_str *fstr); 3674int f2fs_inline_data_fiemap(struct inode *inode, --- 82 unchanged lines hidden (view full) --- 3757 */ 3758#ifdef CONFIG_F2FS_FS_COMPRESSION 3759bool f2fs_is_compressed_page(struct page *page); 3760struct page *f2fs_compress_control_page(struct page *page); 3761int f2fs_prepare_compress_overwrite(struct inode *inode, 3762 struct page **pagep, pgoff_t index, void **fsdata); 3763bool f2fs_compress_write_end(struct inode *inode, void *fsdata, 3764 pgoff_t index, unsigned copied); | 3769 struct inode *inode, nid_t ino, umode_t mode); 3770void f2fs_delete_inline_entry(struct f2fs_dir_entry *dentry, 3771 struct page *page, struct inode *dir, 3772 struct inode *inode); 3773bool f2fs_empty_inline_dir(struct inode *dir); 3774int f2fs_read_inline_dir(struct file *file, struct dir_context *ctx, 3775 struct fscrypt_str *fstr); 3776int f2fs_inline_data_fiemap(struct inode *inode, --- 82 unchanged lines hidden (view full) --- 3859 */ 3860#ifdef CONFIG_F2FS_FS_COMPRESSION 3861bool f2fs_is_compressed_page(struct page *page); 3862struct page *f2fs_compress_control_page(struct page *page); 3863int f2fs_prepare_compress_overwrite(struct inode *inode, 3864 struct page **pagep, pgoff_t index, void **fsdata); 3865bool f2fs_compress_write_end(struct inode *inode, void *fsdata, 3866 pgoff_t index, unsigned copied); |
3867int f2fs_truncate_partial_cluster(struct inode *inode, u64 from, bool lock); |
|
3765void f2fs_compress_write_end_io(struct bio *bio, struct page *page); 3766bool f2fs_is_compress_backend_ready(struct inode *inode); | 3868void f2fs_compress_write_end_io(struct bio *bio, struct page *page); 3869bool f2fs_is_compress_backend_ready(struct inode *inode); |
3870int f2fs_init_compress_mempool(void); 3871void f2fs_destroy_compress_mempool(void); |
|
3767void f2fs_decompress_pages(struct bio *bio, struct page *page, bool verity); 3768bool f2fs_cluster_is_empty(struct compress_ctx *cc); 3769bool f2fs_cluster_can_merge_page(struct compress_ctx *cc, pgoff_t index); 3770void f2fs_compress_ctx_add_page(struct compress_ctx *cc, struct page *page); 3771int f2fs_write_multi_pages(struct compress_ctx *cc, 3772 int *submitted, 3773 struct writeback_control *wbc, 3774 enum iostat_type io_type); 3775int f2fs_is_compressed_cluster(struct inode *inode, pgoff_t index); 3776int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret, 3777 unsigned nr_pages, sector_t *last_block_in_bio, | 3872void f2fs_decompress_pages(struct bio *bio, struct page *page, bool verity); 3873bool f2fs_cluster_is_empty(struct compress_ctx *cc); 3874bool f2fs_cluster_can_merge_page(struct compress_ctx *cc, pgoff_t index); 3875void f2fs_compress_ctx_add_page(struct compress_ctx *cc, struct page *page); 3876int f2fs_write_multi_pages(struct compress_ctx *cc, 3877 int *submitted, 3878 struct writeback_control *wbc, 3879 enum iostat_type io_type); 3880int f2fs_is_compressed_cluster(struct inode *inode, pgoff_t index); 3881int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret, 3882 unsigned nr_pages, sector_t *last_block_in_bio, |
3778 bool is_readahead); | 3883 bool is_readahead, bool for_write); |
3779struct decompress_io_ctx *f2fs_alloc_dic(struct compress_ctx *cc); 3780void f2fs_free_dic(struct decompress_io_ctx *dic); 3781void f2fs_decompress_end_io(struct page **rpages, 3782 unsigned int cluster_size, bool err, bool verity); 3783int f2fs_init_compress_ctx(struct compress_ctx *cc); 3784void f2fs_destroy_compress_ctx(struct compress_ctx *cc); 3785void f2fs_init_compress_info(struct f2fs_sb_info *sbi); 3786#else --- 5 unchanged lines hidden (view full) --- 3792 /* not support compression */ 3793 return false; 3794} 3795static inline struct page *f2fs_compress_control_page(struct page *page) 3796{ 3797 WARN_ON_ONCE(1); 3798 return ERR_PTR(-EINVAL); 3799} | 3884struct decompress_io_ctx *f2fs_alloc_dic(struct compress_ctx *cc); 3885void f2fs_free_dic(struct decompress_io_ctx *dic); 3886void f2fs_decompress_end_io(struct page **rpages, 3887 unsigned int cluster_size, bool err, bool verity); 3888int f2fs_init_compress_ctx(struct compress_ctx *cc); 3889void f2fs_destroy_compress_ctx(struct compress_ctx *cc); 3890void f2fs_init_compress_info(struct f2fs_sb_info *sbi); 3891#else --- 5 unchanged lines hidden (view full) --- 3897 /* not support compression */ 3898 return false; 3899} 3900static inline struct page *f2fs_compress_control_page(struct page *page) 3901{ 3902 WARN_ON_ONCE(1); 3903 return ERR_PTR(-EINVAL); 3904} |
3905static inline int f2fs_init_compress_mempool(void) { return 0; } 3906static inline void f2fs_destroy_compress_mempool(void) { } |
|
3800#endif 3801 3802static inline void set_compress_context(struct inode *inode) 3803{ 3804 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); 3805 3806 F2FS_I(inode)->i_compress_algorithm = 3807 F2FS_OPTION(sbi).compress_algorithm; 3808 F2FS_I(inode)->i_log_cluster_size = 3809 F2FS_OPTION(sbi).compress_log_size; 3810 F2FS_I(inode)->i_cluster_size = 3811 1 << F2FS_I(inode)->i_log_cluster_size; 3812 F2FS_I(inode)->i_flags |= F2FS_COMPR_FL; 3813 set_inode_flag(inode, FI_COMPRESSED_FILE); 3814 stat_inc_compr_inode(inode); | 3907#endif 3908 3909static inline void set_compress_context(struct inode *inode) 3910{ 3911 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); 3912 3913 F2FS_I(inode)->i_compress_algorithm = 3914 F2FS_OPTION(sbi).compress_algorithm; 3915 F2FS_I(inode)->i_log_cluster_size = 3916 F2FS_OPTION(sbi).compress_log_size; 3917 F2FS_I(inode)->i_cluster_size = 3918 1 << F2FS_I(inode)->i_log_cluster_size; 3919 F2FS_I(inode)->i_flags |= F2FS_COMPR_FL; 3920 set_inode_flag(inode, FI_COMPRESSED_FILE); 3921 stat_inc_compr_inode(inode); |
3922 f2fs_mark_inode_dirty_sync(inode, true); |
|
3815} 3816 3817static inline u64 f2fs_disable_compressed_file(struct inode *inode) 3818{ 3819 struct f2fs_inode_info *fi = F2FS_I(inode); 3820 3821 if (!f2fs_compressed_file(inode)) 3822 return 0; | 3923} 3924 3925static inline u64 f2fs_disable_compressed_file(struct inode *inode) 3926{ 3927 struct f2fs_inode_info *fi = F2FS_I(inode); 3928 3929 if (!f2fs_compressed_file(inode)) 3930 return 0; |
3823 if (fi->i_compr_blocks) 3824 return fi->i_compr_blocks; | 3931 if (S_ISREG(inode->i_mode)) { 3932 if (get_dirty_pages(inode)) 3933 return 1; 3934 if (fi->i_compr_blocks) 3935 return fi->i_compr_blocks; 3936 } |
3825 3826 fi->i_flags &= ~F2FS_COMPR_FL; | 3937 3938 fi->i_flags &= ~F2FS_COMPR_FL; |
3827 clear_inode_flag(inode, FI_COMPRESSED_FILE); | |
3828 stat_dec_compr_inode(inode); | 3939 stat_dec_compr_inode(inode); |
3940 clear_inode_flag(inode, FI_COMPRESSED_FILE); 3941 f2fs_mark_inode_dirty_sync(inode, true); |
|
3829 return 0; 3830} 3831 3832#define F2FS_FEATURE_FUNCS(name, flagname) \ 3833static inline int f2fs_sb_has_##name(struct f2fs_sb_info *sbi) \ 3834{ \ 3835 return F2FS_HAS_FEATURE(sbi, F2FS_FEATURE_##flagname); \ 3836} --- 60 unchanged lines hidden (view full) --- 3897 return bdev_read_only(sbi->sb->s_bdev); 3898 3899 for (i = 0; i < sbi->s_ndevs; i++) 3900 if (bdev_read_only(FDEV(i).bdev)) 3901 return true; 3902 return false; 3903} 3904 | 3942 return 0; 3943} 3944 3945#define F2FS_FEATURE_FUNCS(name, flagname) \ 3946static inline int f2fs_sb_has_##name(struct f2fs_sb_info *sbi) \ 3947{ \ 3948 return F2FS_HAS_FEATURE(sbi, F2FS_FEATURE_##flagname); \ 3949} --- 60 unchanged lines hidden (view full) --- 4010 return bdev_read_only(sbi->sb->s_bdev); 4011 4012 for (i = 0; i < sbi->s_ndevs; i++) 4013 if (bdev_read_only(FDEV(i).bdev)) 4014 return true; 4015 return false; 4016} 4017 |
3905 3906static inline void set_opt_mode(struct f2fs_sb_info *sbi, unsigned int mt) | 4018static inline bool f2fs_lfs_mode(struct f2fs_sb_info *sbi) |
3907{ | 4019{ |
3908 clear_opt(sbi, ADAPTIVE); 3909 clear_opt(sbi, LFS); 3910 3911 switch (mt) { 3912 case F2FS_MOUNT_ADAPTIVE: 3913 set_opt(sbi, ADAPTIVE); 3914 break; 3915 case F2FS_MOUNT_LFS: 3916 set_opt(sbi, LFS); 3917 break; 3918 } | 4020 return F2FS_OPTION(sbi).fs_mode == FS_MODE_LFS; |
3919} 3920 | 4021} 4022 |
3921static inline bool f2fs_may_encrypt(struct inode *inode) | 4023static inline bool f2fs_may_encrypt(struct inode *dir, struct inode *inode) |
3922{ 3923#ifdef CONFIG_FS_ENCRYPTION | 4024{ 4025#ifdef CONFIG_FS_ENCRYPTION |
4026 struct f2fs_sb_info *sbi = F2FS_I_SB(dir); |
|
3924 umode_t mode = inode->i_mode; 3925 | 4027 umode_t mode = inode->i_mode; 4028 |
3926 return (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)); 3927#else 3928 return false; | 4029 /* 4030 * If the directory encrypted or dummy encryption enabled, 4031 * then we should encrypt the inode. 4032 */ 4033 if (IS_ENCRYPTED(dir) || DUMMY_ENCRYPTION_ENABLED(sbi)) 4034 return (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)); |
3929#endif | 4035#endif |
4036 return false; |
|
3930} 3931 3932static inline bool f2fs_may_compress(struct inode *inode) 3933{ 3934 if (IS_SWAPFILE(inode) || f2fs_is_pinned_file(inode) || 3935 f2fs_is_atomic_file(inode) || 3936 f2fs_is_volatile_file(inode)) 3937 return false; 3938 return S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode); 3939} 3940 3941static inline void f2fs_i_compr_blocks_update(struct inode *inode, 3942 u64 blocks, bool add) 3943{ 3944 int diff = F2FS_I(inode)->i_cluster_size - blocks; 3945 | 4037} 4038 4039static inline bool f2fs_may_compress(struct inode *inode) 4040{ 4041 if (IS_SWAPFILE(inode) || f2fs_is_pinned_file(inode) || 4042 f2fs_is_atomic_file(inode) || 4043 f2fs_is_volatile_file(inode)) 4044 return false; 4045 return S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode); 4046} 4047 4048static inline void f2fs_i_compr_blocks_update(struct inode *inode, 4049 u64 blocks, bool add) 4050{ 4051 int diff = F2FS_I(inode)->i_cluster_size - blocks; 4052 |
4053 /* don't update i_compr_blocks if saved blocks were released */ 4054 if (!add && !F2FS_I(inode)->i_compr_blocks) 4055 return; 4056 |
|
3946 if (add) { 3947 F2FS_I(inode)->i_compr_blocks += diff; 3948 stat_add_compr_blocks(inode, diff); 3949 } else { 3950 F2FS_I(inode)->i_compr_blocks -= diff; 3951 stat_sub_compr_blocks(inode, diff); 3952 } 3953 f2fs_mark_inode_dirty_sync(inode, true); --- 11 unchanged lines hidden (view full) --- 3965} 3966 3967static inline int allow_outplace_dio(struct inode *inode, 3968 struct kiocb *iocb, struct iov_iter *iter) 3969{ 3970 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); 3971 int rw = iov_iter_rw(iter); 3972 | 4057 if (add) { 4058 F2FS_I(inode)->i_compr_blocks += diff; 4059 stat_add_compr_blocks(inode, diff); 4060 } else { 4061 F2FS_I(inode)->i_compr_blocks -= diff; 4062 stat_sub_compr_blocks(inode, diff); 4063 } 4064 f2fs_mark_inode_dirty_sync(inode, true); --- 11 unchanged lines hidden (view full) --- 4076} 4077 4078static inline int allow_outplace_dio(struct inode *inode, 4079 struct kiocb *iocb, struct iov_iter *iter) 4080{ 4081 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); 4082 int rw = iov_iter_rw(iter); 4083 |
3973 return (test_opt(sbi, LFS) && (rw == WRITE) && | 4084 return (f2fs_lfs_mode(sbi) && (rw == WRITE) && |
3974 !block_unaligned_IO(inode, iocb, iter)); 3975} 3976 3977static inline bool f2fs_force_buffered_io(struct inode *inode, 3978 struct kiocb *iocb, struct iov_iter *iter) 3979{ 3980 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); 3981 int rw = iov_iter_rw(iter); 3982 3983 if (f2fs_post_read_required(inode)) 3984 return true; 3985 if (f2fs_is_multi_device(sbi)) 3986 return true; | 4085 !block_unaligned_IO(inode, iocb, iter)); 4086} 4087 4088static inline bool f2fs_force_buffered_io(struct inode *inode, 4089 struct kiocb *iocb, struct iov_iter *iter) 4090{ 4091 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); 4092 int rw = iov_iter_rw(iter); 4093 4094 if (f2fs_post_read_required(inode)) 4095 return true; 4096 if (f2fs_is_multi_device(sbi)) 4097 return true; |
3987 if (f2fs_compressed_file(inode)) 3988 return true; | |
3989 /* 3990 * for blkzoned device, fallback direct IO to buffered IO, so 3991 * all IOs can be serialized by log-structured write. 3992 */ 3993 if (f2fs_sb_has_blkzoned(sbi)) 3994 return true; | 4098 /* 4099 * for blkzoned device, fallback direct IO to buffered IO, so 4100 * all IOs can be serialized by log-structured write. 4101 */ 4102 if (f2fs_sb_has_blkzoned(sbi)) 4103 return true; |
3995 if (test_opt(sbi, LFS) && (rw == WRITE)) { | 4104 if (f2fs_lfs_mode(sbi) && (rw == WRITE)) { |
3996 if (block_unaligned_IO(inode, iocb, iter)) 3997 return true; 3998 if (F2FS_IO_ALIGNED(sbi)) 3999 return true; 4000 } 4001 if (is_sbi_flag_set(F2FS_I_SB(inode), SBI_CP_DISABLED) && 4002 !IS_SWAPFILE(inode)) 4003 return true; --- 28 unchanged lines hidden --- | 4105 if (block_unaligned_IO(inode, iocb, iter)) 4106 return true; 4107 if (F2FS_IO_ALIGNED(sbi)) 4108 return true; 4109 } 4110 if (is_sbi_flag_set(F2FS_I_SB(inode), SBI_CP_DISABLED) && 4111 !IS_SWAPFILE(inode)) 4112 return true; --- 28 unchanged lines hidden --- |