f2fs.h (1ae18f71cb522684bac1718f5c188fb5e30eb23d) f2fs.h (ed318a6cc0b620440e65f48eb527dc3df7269ce4)
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

--- 123 unchanged lines hidden (view full) ---

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 */
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

--- 123 unchanged lines hidden (view full) ---

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 */
142 block_t unusable_cap_perc; /* percentage for cap */
141 struct fscrypt_dummy_context dummy_enc_ctx; /* test dummy encryption */
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
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
198#define CP_RESIZE 0x00000080
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 */

--- 218 unchanged lines hidden (view full) ---

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)
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 */

--- 218 unchanged lines hidden (view full) ---

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)
430#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)
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 */
431
432#define F2FS_IOC_GET_VOLUME_NAME FS_IOC_GETFSLABEL
433#define F2FS_IOC_SET_VOLUME_NAME FS_IOC_SETFSLABEL
434
435#define F2FS_IOC_SET_ENCRYPTION_POLICY FS_IOC_SET_ENCRYPTION_POLICY
436#define F2FS_IOC_GET_ENCRYPTION_POLICY FS_IOC_GET_ENCRYPTION_POLICY
437#define F2FS_IOC_GET_ENCRYPTION_PWSALT FS_IOC_GET_ENCRYPTION_PWSALT
438

--- 62 unchanged lines hidden (view full) ---

501 ((SIZE_OF_DIR_ENTRY + F2FS_SLOT_LEN) * \
502 NR_INLINE_DENTRY(inode) + \
503 INLINE_DENTRY_BITMAP_SIZE(inode)))
504
505/*
506 * For INODE and NODE manager
507 */
508/* 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
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};

--- 566 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 {
509struct f2fs_dentry_ptr {
510 struct inode *inode;
511 void *bitmap;
512 struct f2fs_dir_entry *dentry;
513 __u8 (*filename)[F2FS_SLOT_LEN];
514 int max;
515 int nr_bitmap;
516};

--- 566 unchanged lines hidden (view full) ---

1083 CP_NO_SPC_ROLL,
1084 CP_NODE_NEED_CP,
1085 CP_FASTBOOT_MODE,
1086 CP_SPEC_LOG_NUM,
1087 CP_RECOVER_DIR,
1088};
1089
1090enum iostat_type {
1133 /* WRITE IO */
1134 APP_DIRECT_IO, /* app direct write IOs */
1135 APP_BUFFERED_IO, /* app buffered write IOs */
1091 APP_DIRECT_IO, /* app direct IOs */
1092 APP_BUFFERED_IO, /* app buffered IOs */
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 */
1093 APP_WRITE_IO, /* app write IOs */
1094 APP_MAPPED_IO, /* app mapped IOs */
1095 FS_DATA_IO, /* data IOs from kworker/fsync/reclaimer */
1096 FS_NODE_IO, /* node IOs from kworker/fsync/reclaimer */
1097 FS_META_IO, /* meta IOs from kworker/reclaimer */
1098 FS_GC_DATA_IO, /* data IOs from forground gc */
1099 FS_GC_NODE_IO, /* node IOs from forground gc */
1100 FS_CP_DATA_IO, /* data IOs from checkpoint */
1101 FS_CP_NODE_IO, /* node IOs from checkpoint */
1102 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 */
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 */

--- 143 unchanged lines hidden (view full) ---

1310
1311#define IS_ATOMIC_WRITTEN_PAGE(page) \
1312 (page_private(page) == (unsigned long)ATOMIC_WRITTEN_PAGE)
1313#define IS_DUMMY_WRITTEN_PAGE(page) \
1314 (page_private(page) == (unsigned long)DUMMY_WRITTEN_PAGE)
1315
1316#ifdef CONFIG_FS_ENCRYPTION
1317#define DUMMY_ENCRYPTION_ENABLED(sbi) \
1103 FS_DISCARD, /* discard */
1104 NR_IO_TYPE,
1105};
1106
1107struct f2fs_io_info {
1108 struct f2fs_sb_info *sbi; /* f2fs_sb_info pointer */
1109 nid_t ino; /* inode number */
1110 enum page_type type; /* contains DATA/NODE/META/META_FLUSH */

--- 143 unchanged lines hidden (view full) ---

1254
1255#define IS_ATOMIC_WRITTEN_PAGE(page) \
1256 (page_private(page) == (unsigned long)ATOMIC_WRITTEN_PAGE)
1257#define IS_DUMMY_WRITTEN_PAGE(page) \
1258 (page_private(page) == (unsigned long)DUMMY_WRITTEN_PAGE)
1259
1260#ifdef CONFIG_FS_ENCRYPTION
1261#define DUMMY_ENCRYPTION_ENABLED(sbi) \
1318 (unlikely(F2FS_OPTION(sbi).test_dummy_encryption))
1262 (unlikely(F2FS_OPTION(sbi).dummy_enc_ctx.ctx != NULL))
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,
1263#else
1264#define DUMMY_ENCRYPTION_ENABLED(sbi) (0)
1265#endif
1266
1267/* For compression */
1268enum compress_algorithm_type {
1269 COMPRESS_LZO,
1270 COMPRESS_LZ4,
1271 COMPRESS_ZSTD,
1328 COMPRESS_LZORLE,
1329 COMPRESS_MAX,
1330};
1331
1332#define COMPRESS_DATA_RESERVED_SIZE 5
1333struct compress_data {
1334 __le32 clen; /* compressed data size */
1335 __le32 reserved[COMPRESS_DATA_RESERVED_SIZE]; /* reserved */
1336 u8 cdata[]; /* compressed data */

--- 133 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 */
1272 COMPRESS_MAX,
1273};
1274
1275#define COMPRESS_DATA_RESERVED_SIZE 5
1276struct compress_data {
1277 __le32 clen; /* compressed data size */
1278 __le32 reserved[COMPRESS_DATA_RESERVED_SIZE]; /* reserved */
1279 u8 cdata[]; /* compressed data */

--- 133 unchanged lines hidden (view full) ---

1413 unsigned int root_ino_num; /* root inode number*/
1414 unsigned int node_ino_num; /* node inode number*/
1415 unsigned int meta_ino_num; /* meta inode number*/
1416 unsigned int log_blocks_per_seg; /* log2 blocks per segment */
1417 unsigned int blocks_per_seg; /* blocks per segment */
1418 unsigned int segs_per_sec; /* segments per section */
1419 unsigned int secs_per_zone; /* sections per zone */
1420 unsigned int total_sections; /* total section count */
1421 struct mutex resize_mutex; /* for resize exclusion */
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;
1422 unsigned int total_node_count; /* total node block count */
1423 unsigned int total_valid_node_count; /* valid node block count */
1424 loff_t max_file_blocks; /* max block index of file */
1425 int dir_level; /* directory level */
1426 int readdir_ra; /* readahead inode in readdir */
1427
1428 block_t user_block_count; /* # of user blocks */
1429 block_t total_valid_block_count; /* # of valid blocks */

--- 69 unchanged lines hidden (view full) ---

1499 unsigned int io_skip_bggc; /* skip background gc for in-flight IO */
1500 unsigned int other_skip_bggc; /* skip background gc for other reasons */
1501 unsigned int ndirty_inode[NR_INODE_TYPE]; /* # of dirty inodes */
1502#endif
1503 spinlock_t stat_lock; /* lock for stat operations */
1504
1505 /* For app/fs IO statistics */
1506 spinlock_t iostat_lock;
1563 unsigned long long rw_iostat[NR_IO_TYPE];
1564 unsigned long long prev_rw_iostat[NR_IO_TYPE];
1507 unsigned long long write_iostat[NR_IO_TYPE];
1565 bool iostat_enable;
1508 bool iostat_enable;
1566 unsigned long iostat_next_period;
1567 unsigned int iostat_period_ms;
1568
1509
1569 /* to attach REQ_META|REQ_FUA flags */
1570 unsigned int data_io_flag;
1571
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 */

--- 1379 unchanged lines hidden (view full) ---

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
1510 /* For sysfs suppport */
1511 struct kobject s_kobj;
1512 struct completion s_kobj_unregister;
1513
1514 /* For shrinker support */
1515 struct list_head s_list;
1516 int s_ndevs; /* number of devices */
1517 struct f2fs_dev_info *devs; /* for device list */

--- 1379 unchanged lines hidden (view full) ---

2897 return sb_rdonly(sb);
2898}
2899
2900static inline bool f2fs_cp_error(struct f2fs_sb_info *sbi)
2901{
2902 return is_set_ckpt_flags(sbi, CP_ERROR_FLAG);
2903}
2904
2967static inline bool is_dot_dotdot(const u8 *name, size_t len)
2905static inline bool is_dot_dotdot(const struct qstr *str)
2968{
2906{
2969 if (len == 1 && name[0] == '.')
2907 if (str->len == 1 && str->name[0] == '.')
2970 return true;
2971
2908 return true;
2909
2972 if (len == 2 && name[0] == '.' && name[1] == '.')
2910 if (str->len == 2 && str->name[0] == '.' && str->name[1] == '.')
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);

--- 72 unchanged lines hidden (view full) ---

3053 offsetof(struct f2fs_inode, i_extra_isize)) \
3054
3055#define F2FS_OLD_ATTRIBUTE_SIZE (offsetof(struct f2fs_inode, i_addr))
3056#define F2FS_FITS_IN_INODE(f2fs_inode, extra_isize, field) \
3057 ((offsetof(typeof(*(f2fs_inode)), field) + \
3058 sizeof((f2fs_inode)->field)) \
3059 <= (F2FS_OLD_ATTRIBUTE_SIZE + (extra_isize))) \
3060
2911 return true;
2912
2913 return false;
2914}
2915
2916static inline bool f2fs_may_extent_tree(struct inode *inode)
2917{
2918 struct f2fs_sb_info *sbi = F2FS_I_SB(inode);

--- 72 unchanged lines hidden (view full) ---

2991 offsetof(struct f2fs_inode, i_extra_isize)) \
2992
2993#define F2FS_OLD_ATTRIBUTE_SIZE (offsetof(struct f2fs_inode, i_addr))
2994#define F2FS_FITS_IN_INODE(f2fs_inode, extra_isize, field) \
2995 ((offsetof(typeof(*(f2fs_inode)), field) + \
2996 sizeof((f2fs_inode)->field)) \
2997 <= (F2FS_OLD_ATTRIBUTE_SIZE + (extra_isize))) \
2998
3061#define DEFAULT_IOSTAT_PERIOD_MS 3000
3062#define MIN_IOSTAT_PERIOD_MS 100
3063/* maximum period of iostat tracing is 1 day */
3064#define MAX_IOSTAT_PERIOD_MS 8640000
3065
3066static inline void f2fs_reset_iostat(struct f2fs_sb_info *sbi)
3067{
3068 int i;
3069
3070 spin_lock(&sbi->iostat_lock);
2999static inline void f2fs_reset_iostat(struct f2fs_sb_info *sbi)
3000{
3001 int i;
3002
3003 spin_lock(&sbi->iostat_lock);
3071 for (i = 0; i < NR_IO_TYPE; i++) {
3072 sbi->rw_iostat[i] = 0;
3073 sbi->prev_rw_iostat[i] = 0;
3074 }
3004 for (i = 0; i < NR_IO_TYPE; i++)
3005 sbi->write_iostat[i] = 0;
3075 spin_unlock(&sbi->iostat_lock);
3076}
3077
3006 spin_unlock(&sbi->iostat_lock);
3007}
3008
3078extern void f2fs_record_iostat(struct f2fs_sb_info *sbi);
3079
3080static inline void f2fs_update_iostat(struct f2fs_sb_info *sbi,
3081 enum iostat_type type, unsigned long long io_bytes)
3082{
3083 if (!sbi->iostat_enable)
3084 return;
3085 spin_lock(&sbi->iostat_lock);
3009static inline void f2fs_update_iostat(struct f2fs_sb_info *sbi,
3010 enum iostat_type type, unsigned long long io_bytes)
3011{
3012 if (!sbi->iostat_enable)
3013 return;
3014 spin_lock(&sbi->iostat_lock);
3086 sbi->rw_iostat[type] += io_bytes;
3015 sbi->write_iostat[type] += io_bytes;
3087
3088 if (type == APP_WRITE_IO || type == APP_DIRECT_IO)
3016
3017 if (type == APP_WRITE_IO || type == APP_DIRECT_IO)
3089 sbi->rw_iostat[APP_BUFFERED_IO] =
3090 sbi->rw_iostat[APP_WRITE_IO] -
3091 sbi->rw_iostat[APP_DIRECT_IO];
3092
3093 if (type == APP_READ_IO || type == APP_DIRECT_READ_IO)
3094 sbi->rw_iostat[APP_BUFFERED_READ_IO] =
3095 sbi->rw_iostat[APP_READ_IO] -
3096 sbi->rw_iostat[APP_DIRECT_READ_IO];
3018 sbi->write_iostat[APP_BUFFERED_IO] =
3019 sbi->write_iostat[APP_WRITE_IO] -
3020 sbi->write_iostat[APP_DIRECT_IO];
3097 spin_unlock(&sbi->iostat_lock);
3021 spin_unlock(&sbi->iostat_lock);
3098
3099 f2fs_record_iostat(sbi);
3100}
3101
3102#define __is_large_section(sbi) ((sbi)->segs_per_sec > 1)
3103
3104#define __is_meta_io(fio) (PAGE_TYPE_OF_BIO((fio)->type) == META)
3105
3106bool f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi,
3107 block_t blkaddr, int type);

--- 36 unchanged lines hidden (view full) ---

3144 f2fs_put_page(page, 0);
3145}
3146
3147/*
3148 * file.c
3149 */
3150int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync);
3151void f2fs_truncate_data_blocks(struct dnode_of_data *dn);
3022}
3023
3024#define __is_large_section(sbi) ((sbi)->segs_per_sec > 1)
3025
3026#define __is_meta_io(fio) (PAGE_TYPE_OF_BIO((fio)->type) == META)
3027
3028bool f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi,
3029 block_t blkaddr, int type);

--- 36 unchanged lines hidden (view full) ---

3066 f2fs_put_page(page, 0);
3067}
3068
3069/*
3070 * file.c
3071 */
3072int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync);
3073void f2fs_truncate_data_blocks(struct dnode_of_data *dn);
3152int f2fs_do_truncate_blocks(struct inode *inode, u64 from, bool lock);
3153int f2fs_truncate_blocks(struct inode *inode, u64 from, bool lock);
3154int f2fs_truncate(struct inode *inode);
3155int f2fs_getattr(const struct path *path, struct kstat *stat,
3156 u32 request_mask, unsigned int flags);
3157int f2fs_setattr(struct dentry *dentry, struct iattr *attr);
3158int f2fs_truncate_hole(struct inode *inode, pgoff_t pg_start, pgoff_t pg_end);
3159void f2fs_truncate_data_blocks_range(struct dnode_of_data *dn, int count);
3160int f2fs_precache_extents(struct inode *inode);

--- 19 unchanged lines hidden (view full) ---

3180
3181/*
3182 * namei.c
3183 */
3184int f2fs_update_extension_list(struct f2fs_sb_info *sbi, const char *name,
3185 bool hot, bool set);
3186struct dentry *f2fs_get_parent(struct dentry *child);
3187
3074int f2fs_truncate_blocks(struct inode *inode, u64 from, bool lock);
3075int f2fs_truncate(struct inode *inode);
3076int f2fs_getattr(const struct path *path, struct kstat *stat,
3077 u32 request_mask, unsigned int flags);
3078int f2fs_setattr(struct dentry *dentry, struct iattr *attr);
3079int f2fs_truncate_hole(struct inode *inode, pgoff_t pg_start, pgoff_t pg_end);
3080void f2fs_truncate_data_blocks_range(struct dnode_of_data *dn, int count);
3081int f2fs_precache_extents(struct inode *inode);

--- 19 unchanged lines hidden (view full) ---

3101
3102/*
3103 * namei.c
3104 */
3105int f2fs_update_extension_list(struct f2fs_sb_info *sbi, const char *name,
3106 bool hot, bool set);
3107struct dentry *f2fs_get_parent(struct dentry *child);
3108
3109extern int f2fs_ci_compare(const struct inode *parent,
3110 const struct qstr *name,
3111 const struct qstr *entry,
3112 bool quick);
3113
3188/*
3189 * dir.c
3190 */
3191unsigned char f2fs_get_de_type(struct f2fs_dir_entry *de);
3114/*
3115 * dir.c
3116 */
3117unsigned char f2fs_get_de_type(struct f2fs_dir_entry *de);
3192int f2fs_init_casefolded_name(const struct inode *dir,
3193 struct f2fs_filename *fname);
3194int f2fs_setup_filename(struct inode *dir, const struct qstr *iname,
3195 int lookup, struct f2fs_filename *fname);
3196int f2fs_prepare_lookup(struct inode *dir, struct dentry *dentry,
3197 struct f2fs_filename *fname);
3198void f2fs_free_filename(struct f2fs_filename *fname);
3199struct f2fs_dir_entry *f2fs_find_target_dentry(const struct f2fs_dentry_ptr *d,
3200 const struct f2fs_filename *fname, int *max_slots);
3118struct f2fs_dir_entry *f2fs_find_target_dentry(struct fscrypt_name *fname,
3119 f2fs_hash_t namehash, int *max_slots,
3120 struct f2fs_dentry_ptr *d);
3201int f2fs_fill_dentries(struct dir_context *ctx, struct f2fs_dentry_ptr *d,
3202 unsigned int start_pos, struct fscrypt_str *fstr);
3203void f2fs_do_make_empty_dir(struct inode *inode, struct inode *parent,
3204 struct f2fs_dentry_ptr *d);
3205struct page *f2fs_init_inode_metadata(struct inode *inode, struct inode *dir,
3121int f2fs_fill_dentries(struct dir_context *ctx, struct f2fs_dentry_ptr *d,
3122 unsigned int start_pos, struct fscrypt_str *fstr);
3123void f2fs_do_make_empty_dir(struct inode *inode, struct inode *parent,
3124 struct f2fs_dentry_ptr *d);
3125struct page *f2fs_init_inode_metadata(struct inode *inode, struct inode *dir,
3206 const struct f2fs_filename *fname, struct page *dpage);
3126 const struct qstr *new_name,
3127 const struct qstr *orig_name, struct page *dpage);
3207void f2fs_update_parent_metadata(struct inode *dir, struct inode *inode,
3208 unsigned int current_depth);
3209int f2fs_room_for_filename(const void *bitmap, int slots, int max_slots);
3210void f2fs_drop_nlink(struct inode *dir, struct inode *inode);
3211struct f2fs_dir_entry *__f2fs_find_entry(struct inode *dir,
3128void f2fs_update_parent_metadata(struct inode *dir, struct inode *inode,
3129 unsigned int current_depth);
3130int f2fs_room_for_filename(const void *bitmap, int slots, int max_slots);
3131void f2fs_drop_nlink(struct inode *dir, struct inode *inode);
3132struct f2fs_dir_entry *__f2fs_find_entry(struct inode *dir,
3212 const struct f2fs_filename *fname,
3213 struct page **res_page);
3133 struct fscrypt_name *fname, struct page **res_page);
3214struct f2fs_dir_entry *f2fs_find_entry(struct inode *dir,
3215 const struct qstr *child, struct page **res_page);
3216struct f2fs_dir_entry *f2fs_parent_dir(struct inode *dir, struct page **p);
3217ino_t f2fs_inode_by_name(struct inode *dir, const struct qstr *qstr,
3218 struct page **page);
3219void f2fs_set_link(struct inode *dir, struct f2fs_dir_entry *de,
3220 struct page *page, struct inode *inode);
3221bool f2fs_has_enough_room(struct inode *dir, struct page *ipage,
3134struct f2fs_dir_entry *f2fs_find_entry(struct inode *dir,
3135 const struct qstr *child, struct page **res_page);
3136struct f2fs_dir_entry *f2fs_parent_dir(struct inode *dir, struct page **p);
3137ino_t f2fs_inode_by_name(struct inode *dir, const struct qstr *qstr,
3138 struct page **page);
3139void f2fs_set_link(struct inode *dir, struct f2fs_dir_entry *de,
3140 struct page *page, struct inode *inode);
3141bool f2fs_has_enough_room(struct inode *dir, struct page *ipage,
3222 const struct f2fs_filename *fname);
3142 struct fscrypt_name *fname);
3223void f2fs_update_dentry(nid_t ino, umode_t mode, struct f2fs_dentry_ptr *d,
3143void f2fs_update_dentry(nid_t ino, umode_t mode, struct f2fs_dentry_ptr *d,
3224 const struct fscrypt_str *name, f2fs_hash_t name_hash,
3144 const struct qstr *name, f2fs_hash_t name_hash,
3225 unsigned int bit_pos);
3145 unsigned int bit_pos);
3226int f2fs_add_regular_entry(struct inode *dir, const struct f2fs_filename *fname,
3146int f2fs_add_regular_entry(struct inode *dir, const struct qstr *new_name,
3147 const struct qstr *orig_name,
3227 struct inode *inode, nid_t ino, umode_t mode);
3148 struct inode *inode, nid_t ino, umode_t mode);
3228int f2fs_add_dentry(struct inode *dir, const struct f2fs_filename *fname,
3149int f2fs_add_dentry(struct inode *dir, struct fscrypt_name *fname,
3229 struct inode *inode, nid_t ino, umode_t mode);
3230int f2fs_do_add_link(struct inode *dir, const struct qstr *name,
3231 struct inode *inode, nid_t ino, umode_t mode);
3232void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page,
3233 struct inode *dir, struct inode *inode);
3234int f2fs_do_tmpfile(struct inode *inode, struct inode *dir);
3235bool f2fs_empty_dir(struct inode *dir);
3236

--- 13 unchanged lines hidden (view full) ---

3250void f2fs_quota_off_umount(struct super_block *sb);
3251int f2fs_commit_super(struct f2fs_sb_info *sbi, bool recover);
3252int f2fs_sync_fs(struct super_block *sb, int sync);
3253int f2fs_sanity_check_ckpt(struct f2fs_sb_info *sbi);
3254
3255/*
3256 * hash.c
3257 */
3150 struct inode *inode, nid_t ino, umode_t mode);
3151int f2fs_do_add_link(struct inode *dir, const struct qstr *name,
3152 struct inode *inode, nid_t ino, umode_t mode);
3153void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page,
3154 struct inode *dir, struct inode *inode);
3155int f2fs_do_tmpfile(struct inode *inode, struct inode *dir);
3156bool f2fs_empty_dir(struct inode *dir);
3157

--- 13 unchanged lines hidden (view full) ---

3171void f2fs_quota_off_umount(struct super_block *sb);
3172int f2fs_commit_super(struct f2fs_sb_info *sbi, bool recover);
3173int f2fs_sync_fs(struct super_block *sb, int sync);
3174int f2fs_sanity_check_ckpt(struct f2fs_sb_info *sbi);
3175
3176/*
3177 * hash.c
3178 */
3258void f2fs_hash_filename(const struct inode *dir, struct f2fs_filename *fname);
3179f2fs_hash_t f2fs_dentry_hash(const struct inode *dir,
3180 const struct qstr *name_info, struct fscrypt_name *fname);
3259
3260/*
3261 * node.c
3262 */
3263struct dnode_of_data;
3264struct node_info;
3265
3266int f2fs_check_nid_range(struct f2fs_sb_info *sbi, nid_t nid);

--- 15 unchanged lines hidden (view full) ---

3282 unsigned int seq_id);
3283int f2fs_remove_inode_page(struct inode *inode);
3284struct page *f2fs_new_inode_page(struct inode *inode);
3285struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs);
3286void f2fs_ra_node_page(struct f2fs_sb_info *sbi, nid_t nid);
3287struct page *f2fs_get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid);
3288struct page *f2fs_get_node_page_ra(struct page *parent, int start);
3289int f2fs_move_node_page(struct page *node_page, int gc_type);
3181
3182/*
3183 * node.c
3184 */
3185struct dnode_of_data;
3186struct node_info;
3187
3188int f2fs_check_nid_range(struct f2fs_sb_info *sbi, nid_t nid);

--- 15 unchanged lines hidden (view full) ---

3204 unsigned int seq_id);
3205int f2fs_remove_inode_page(struct inode *inode);
3206struct page *f2fs_new_inode_page(struct inode *inode);
3207struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs);
3208void f2fs_ra_node_page(struct f2fs_sb_info *sbi, nid_t nid);
3209struct page *f2fs_get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid);
3210struct page *f2fs_get_node_page_ra(struct page *parent, int start);
3211int f2fs_move_node_page(struct page *node_page, int gc_type);
3290int f2fs_flush_inline_data(struct f2fs_sb_info *sbi);
3291int f2fs_fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode,
3292 struct writeback_control *wbc, bool atomic,
3293 unsigned int *seq_id);
3294int f2fs_sync_node_pages(struct f2fs_sb_info *sbi,
3295 struct writeback_control *wbc,
3296 bool do_balance, enum iostat_type io_type);
3297int f2fs_build_free_nids(struct f2fs_sb_info *sbi, bool sync, bool mount);
3298bool f2fs_alloc_nid(struct f2fs_sb_info *sbi, nid_t *nid);

--- 430 unchanged lines hidden (view full) ---

3729#define stat_inc_tot_blk_count(si, blks) do { } while (0)
3730#define stat_inc_data_blk_count(sbi, blks, gc_type) do { } while (0)
3731#define stat_inc_node_blk_count(sbi, blks, gc_type) do { } while (0)
3732
3733static inline int f2fs_build_stats(struct f2fs_sb_info *sbi) { return 0; }
3734static inline void f2fs_destroy_stats(struct f2fs_sb_info *sbi) { }
3735static inline void __init f2fs_create_root_stats(void) { }
3736static inline void f2fs_destroy_root_stats(void) { }
3212int f2fs_fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode,
3213 struct writeback_control *wbc, bool atomic,
3214 unsigned int *seq_id);
3215int f2fs_sync_node_pages(struct f2fs_sb_info *sbi,
3216 struct writeback_control *wbc,
3217 bool do_balance, enum iostat_type io_type);
3218int f2fs_build_free_nids(struct f2fs_sb_info *sbi, bool sync, bool mount);
3219bool f2fs_alloc_nid(struct f2fs_sb_info *sbi, nid_t *nid);

--- 430 unchanged lines hidden (view full) ---

3650#define stat_inc_tot_blk_count(si, blks) do { } while (0)
3651#define stat_inc_data_blk_count(sbi, blks, gc_type) do { } while (0)
3652#define stat_inc_node_blk_count(sbi, blks, gc_type) do { } while (0)
3653
3654static inline int f2fs_build_stats(struct f2fs_sb_info *sbi) { return 0; }
3655static inline void f2fs_destroy_stats(struct f2fs_sb_info *sbi) { }
3656static inline void __init f2fs_create_root_stats(void) { }
3657static inline void f2fs_destroy_root_stats(void) { }
3737static inline void f2fs_update_sit_info(struct f2fs_sb_info *sbi) {}
3658static inline void update_sit_info(struct f2fs_sb_info *sbi) {}
3738#endif
3739
3740extern const struct file_operations f2fs_dir_operations;
3741#ifdef CONFIG_UNICODE
3742extern const struct dentry_operations f2fs_dentry_ops;
3743#endif
3744extern const struct file_operations f2fs_file_operations;
3745extern const struct inode_operations f2fs_file_inode_operations;

--- 16 unchanged lines hidden (view full) ---

3762 struct page *ipage, u64 from);
3763int f2fs_read_inline_data(struct inode *inode, struct page *page);
3764int f2fs_convert_inline_page(struct dnode_of_data *dn, struct page *page);
3765int f2fs_convert_inline_inode(struct inode *inode);
3766int f2fs_try_convert_inline_dir(struct inode *dir, struct dentry *dentry);
3767int f2fs_write_inline_data(struct inode *inode, struct page *page);
3768bool f2fs_recover_inline_data(struct inode *inode, struct page *npage);
3769struct f2fs_dir_entry *f2fs_find_in_inline_dir(struct inode *dir,
3659#endif
3660
3661extern const struct file_operations f2fs_dir_operations;
3662#ifdef CONFIG_UNICODE
3663extern const struct dentry_operations f2fs_dentry_ops;
3664#endif
3665extern const struct file_operations f2fs_file_operations;
3666extern const struct inode_operations f2fs_file_inode_operations;

--- 16 unchanged lines hidden (view full) ---

3683 struct page *ipage, u64 from);
3684int f2fs_read_inline_data(struct inode *inode, struct page *page);
3685int f2fs_convert_inline_page(struct dnode_of_data *dn, struct page *page);
3686int f2fs_convert_inline_inode(struct inode *inode);
3687int f2fs_try_convert_inline_dir(struct inode *dir, struct dentry *dentry);
3688int f2fs_write_inline_data(struct inode *inode, struct page *page);
3689bool f2fs_recover_inline_data(struct inode *inode, struct page *npage);
3690struct f2fs_dir_entry *f2fs_find_in_inline_dir(struct inode *dir,
3770 const struct f2fs_filename *fname,
3771 struct page **res_page);
3691 struct fscrypt_name *fname, struct page **res_page);
3772int f2fs_make_empty_inline_dir(struct inode *inode, struct inode *parent,
3773 struct page *ipage);
3692int f2fs_make_empty_inline_dir(struct inode *inode, struct inode *parent,
3693 struct page *ipage);
3774int f2fs_add_inline_entry(struct inode *dir, const struct f2fs_filename *fname,
3694int f2fs_add_inline_entry(struct inode *dir, const struct qstr *new_name,
3695 const struct qstr *orig_name,
3775 struct inode *inode, nid_t ino, umode_t mode);
3776void f2fs_delete_inline_entry(struct f2fs_dir_entry *dentry,
3777 struct page *page, struct inode *dir,
3778 struct inode *inode);
3779bool f2fs_empty_inline_dir(struct inode *dir);
3780int f2fs_read_inline_dir(struct file *file, struct dir_context *ctx,
3781 struct fscrypt_str *fstr);
3782int f2fs_inline_data_fiemap(struct inode *inode,

--- 82 unchanged lines hidden (view full) ---

3865 */
3866#ifdef CONFIG_F2FS_FS_COMPRESSION
3867bool f2fs_is_compressed_page(struct page *page);
3868struct page *f2fs_compress_control_page(struct page *page);
3869int f2fs_prepare_compress_overwrite(struct inode *inode,
3870 struct page **pagep, pgoff_t index, void **fsdata);
3871bool f2fs_compress_write_end(struct inode *inode, void *fsdata,
3872 pgoff_t index, unsigned copied);
3696 struct inode *inode, nid_t ino, umode_t mode);
3697void f2fs_delete_inline_entry(struct f2fs_dir_entry *dentry,
3698 struct page *page, struct inode *dir,
3699 struct inode *inode);
3700bool f2fs_empty_inline_dir(struct inode *dir);
3701int f2fs_read_inline_dir(struct file *file, struct dir_context *ctx,
3702 struct fscrypt_str *fstr);
3703int f2fs_inline_data_fiemap(struct inode *inode,

--- 82 unchanged lines hidden (view full) ---

3786 */
3787#ifdef CONFIG_F2FS_FS_COMPRESSION
3788bool f2fs_is_compressed_page(struct page *page);
3789struct page *f2fs_compress_control_page(struct page *page);
3790int f2fs_prepare_compress_overwrite(struct inode *inode,
3791 struct page **pagep, pgoff_t index, void **fsdata);
3792bool f2fs_compress_write_end(struct inode *inode, void *fsdata,
3793 pgoff_t index, unsigned copied);
3873int f2fs_truncate_partial_cluster(struct inode *inode, u64 from, bool lock);
3874void f2fs_compress_write_end_io(struct bio *bio, struct page *page);
3875bool f2fs_is_compress_backend_ready(struct inode *inode);
3794void f2fs_compress_write_end_io(struct bio *bio, struct page *page);
3795bool f2fs_is_compress_backend_ready(struct inode *inode);
3876int f2fs_init_compress_mempool(void);
3877void f2fs_destroy_compress_mempool(void);
3878void f2fs_decompress_pages(struct bio *bio, struct page *page, bool verity);
3879bool f2fs_cluster_is_empty(struct compress_ctx *cc);
3880bool f2fs_cluster_can_merge_page(struct compress_ctx *cc, pgoff_t index);
3881void f2fs_compress_ctx_add_page(struct compress_ctx *cc, struct page *page);
3882int f2fs_write_multi_pages(struct compress_ctx *cc,
3883 int *submitted,
3884 struct writeback_control *wbc,
3885 enum iostat_type io_type);

--- 17 unchanged lines hidden (view full) ---

3903 /* not support compression */
3904 return false;
3905}
3906static inline struct page *f2fs_compress_control_page(struct page *page)
3907{
3908 WARN_ON_ONCE(1);
3909 return ERR_PTR(-EINVAL);
3910}
3796void f2fs_decompress_pages(struct bio *bio, struct page *page, bool verity);
3797bool f2fs_cluster_is_empty(struct compress_ctx *cc);
3798bool f2fs_cluster_can_merge_page(struct compress_ctx *cc, pgoff_t index);
3799void f2fs_compress_ctx_add_page(struct compress_ctx *cc, struct page *page);
3800int f2fs_write_multi_pages(struct compress_ctx *cc,
3801 int *submitted,
3802 struct writeback_control *wbc,
3803 enum iostat_type io_type);

--- 17 unchanged lines hidden (view full) ---

3821 /* not support compression */
3822 return false;
3823}
3824static inline struct page *f2fs_compress_control_page(struct page *page)
3825{
3826 WARN_ON_ONCE(1);
3827 return ERR_PTR(-EINVAL);
3828}
3911static inline int f2fs_init_compress_mempool(void) { return 0; }
3912static inline void f2fs_destroy_compress_mempool(void) { }
3913#endif
3914
3915static inline void set_compress_context(struct inode *inode)
3916{
3917 struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
3918
3919 F2FS_I(inode)->i_compress_algorithm =
3920 F2FS_OPTION(sbi).compress_algorithm;

--- 130 unchanged lines hidden (view full) ---

4051 return S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode);
4052}
4053
4054static inline void f2fs_i_compr_blocks_update(struct inode *inode,
4055 u64 blocks, bool add)
4056{
4057 int diff = F2FS_I(inode)->i_cluster_size - blocks;
4058
3829#endif
3830
3831static inline void set_compress_context(struct inode *inode)
3832{
3833 struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
3834
3835 F2FS_I(inode)->i_compress_algorithm =
3836 F2FS_OPTION(sbi).compress_algorithm;

--- 130 unchanged lines hidden (view full) ---

3967 return S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode);
3968}
3969
3970static inline void f2fs_i_compr_blocks_update(struct inode *inode,
3971 u64 blocks, bool add)
3972{
3973 int diff = F2FS_I(inode)->i_cluster_size - blocks;
3974
4059 /* don't update i_compr_blocks if saved blocks were released */
4060 if (!add && !F2FS_I(inode)->i_compr_blocks)
4061 return;
4062
4063 if (add) {
4064 F2FS_I(inode)->i_compr_blocks += diff;
4065 stat_add_compr_blocks(inode, diff);
4066 } else {
4067 F2FS_I(inode)->i_compr_blocks -= diff;
4068 stat_sub_compr_blocks(inode, diff);
4069 }
4070 f2fs_mark_inode_dirty_sync(inode, true);

--- 25 unchanged lines hidden (view full) ---

4096{
4097 struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
4098 int rw = iov_iter_rw(iter);
4099
4100 if (f2fs_post_read_required(inode))
4101 return true;
4102 if (f2fs_is_multi_device(sbi))
4103 return true;
3975 if (add) {
3976 F2FS_I(inode)->i_compr_blocks += diff;
3977 stat_add_compr_blocks(inode, diff);
3978 } else {
3979 F2FS_I(inode)->i_compr_blocks -= diff;
3980 stat_sub_compr_blocks(inode, diff);
3981 }
3982 f2fs_mark_inode_dirty_sync(inode, true);

--- 25 unchanged lines hidden (view full) ---

4008{
4009 struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
4010 int rw = iov_iter_rw(iter);
4011
4012 if (f2fs_post_read_required(inode))
4013 return true;
4014 if (f2fs_is_multi_device(sbi))
4015 return true;
4016 if (f2fs_compressed_file(inode))
4017 return true;
4104 /*
4105 * for blkzoned device, fallback direct IO to buffered IO, so
4106 * all IOs can be serialized by log-structured write.
4107 */
4108 if (f2fs_sb_has_blkzoned(sbi))
4109 return true;
4110 if (f2fs_lfs_mode(sbi) && (rw == WRITE)) {
4111 if (block_unaligned_IO(inode, iocb, iter))

--- 35 unchanged lines hidden ---
4018 /*
4019 * for blkzoned device, fallback direct IO to buffered IO, so
4020 * all IOs can be serialized by log-structured write.
4021 */
4022 if (f2fs_sb_has_blkzoned(sbi))
4023 return true;
4024 if (f2fs_lfs_mode(sbi) && (rw == WRITE)) {
4025 if (block_unaligned_IO(inode, iocb, iter))

--- 35 unchanged lines hidden ---