f2fs.h (db48965264110dd74d1436fc21dac328d04385d2) f2fs.h (602a16d58e9aab3c423bcf051033ea6c9e8a6d37)
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

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

143 * unusable when disabling checkpoint
144 */
145
146 /* For compression */
147 unsigned char compress_algorithm; /* algorithm type */
148 unsigned char compress_log_size; /* cluster log size */
149 bool compress_chksum; /* compressed data chksum */
150 unsigned char compress_ext_cnt; /* extension count */
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

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

143 * unusable when disabling checkpoint
144 */
145
146 /* For compression */
147 unsigned char compress_algorithm; /* algorithm type */
148 unsigned char compress_log_size; /* cluster log size */
149 bool compress_chksum; /* compressed data chksum */
150 unsigned char compress_ext_cnt; /* extension count */
151 int compress_mode; /* compression mode */
151 unsigned char extensions[COMPRESS_EXT_NUM][F2FS_EXTENSION_LEN]; /* extensions */
152};
153
154#define F2FS_FEATURE_ENCRYPT 0x0001
155#define F2FS_FEATURE_BLKZONED 0x0002
156#define F2FS_FEATURE_ATOMIC_WRITE 0x0004
157#define F2FS_FEATURE_EXTRA_ATTR 0x0008
158#define F2FS_FEATURE_PRJQUOTA 0x0010

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

672 FI_EXTRA_ATTR, /* indicate file has extra attribute */
673 FI_PROJ_INHERIT, /* indicate file inherits projectid */
674 FI_PIN_FILE, /* indicate file should not be gced */
675 FI_ATOMIC_REVOKE_REQUEST, /* request to drop atomic data */
676 FI_VERITY_IN_PROGRESS, /* building fs-verity Merkle tree */
677 FI_COMPRESSED_FILE, /* indicate file's data can be compressed */
678 FI_COMPRESS_CORRUPT, /* indicate compressed cluster is corrupted */
679 FI_MMAP_FILE, /* indicate file was mmapped */
152 unsigned char extensions[COMPRESS_EXT_NUM][F2FS_EXTENSION_LEN]; /* extensions */
153};
154
155#define F2FS_FEATURE_ENCRYPT 0x0001
156#define F2FS_FEATURE_BLKZONED 0x0002
157#define F2FS_FEATURE_ATOMIC_WRITE 0x0004
158#define F2FS_FEATURE_EXTRA_ATTR 0x0008
159#define F2FS_FEATURE_PRJQUOTA 0x0010

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

673 FI_EXTRA_ATTR, /* indicate file has extra attribute */
674 FI_PROJ_INHERIT, /* indicate file inherits projectid */
675 FI_PIN_FILE, /* indicate file should not be gced */
676 FI_ATOMIC_REVOKE_REQUEST, /* request to drop atomic data */
677 FI_VERITY_IN_PROGRESS, /* building fs-verity Merkle tree */
678 FI_COMPRESSED_FILE, /* indicate file's data can be compressed */
679 FI_COMPRESS_CORRUPT, /* indicate compressed cluster is corrupted */
680 FI_MMAP_FILE, /* indicate file was mmapped */
681 FI_ENABLE_COMPRESS, /* enable compression in "user" compression mode */
680 FI_MAX, /* max flag, never be used */
681};
682
683struct f2fs_inode_info {
684 struct inode vfs_inode; /* serve a vfs inode */
685 unsigned long i_flags; /* keep an inode flags for ioctl */
686 unsigned char i_advise; /* use to give file attribute hints */
687 unsigned char i_dir_level; /* use for dentry level for large dir */

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

1239};
1240
1241enum fsync_mode {
1242 FSYNC_MODE_POSIX, /* fsync follows posix semantics */
1243 FSYNC_MODE_STRICT, /* fsync behaves in line with ext4 */
1244 FSYNC_MODE_NOBARRIER, /* fsync behaves nobarrier based on posix */
1245};
1246
682 FI_MAX, /* max flag, never be used */
683};
684
685struct f2fs_inode_info {
686 struct inode vfs_inode; /* serve a vfs inode */
687 unsigned long i_flags; /* keep an inode flags for ioctl */
688 unsigned char i_advise; /* use to give file attribute hints */
689 unsigned char i_dir_level; /* use for dentry level for large dir */

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

1241};
1242
1243enum fsync_mode {
1244 FSYNC_MODE_POSIX, /* fsync follows posix semantics */
1245 FSYNC_MODE_STRICT, /* fsync behaves in line with ext4 */
1246 FSYNC_MODE_NOBARRIER, /* fsync behaves nobarrier based on posix */
1247};
1248
1249enum {
1250 COMPR_MODE_FS, /*
1251 * automatically compress compression
1252 * enabled files
1253 */
1254 COMPR_MODE_USER, /*
1255 * automatical compression is disabled.
1256 * user can control the file compression
1257 * using ioctls
1258 */
1259};
1260
1247/*
1248 * this value is set in page as a private data which indicate that
1249 * the page is atomically written, and it is in inmem_pages list.
1250 */
1251#define ATOMIC_WRITTEN_PAGE ((unsigned long)-1)
1252#define DUMMY_WRITTEN_PAGE ((unsigned long)-2)
1253
1254#define IS_ATOMIC_WRITTEN_PAGE(page) \

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

2754}
2755
2756static inline int f2fs_compressed_file(struct inode *inode)
2757{
2758 return S_ISREG(inode->i_mode) &&
2759 is_inode_flag_set(inode, FI_COMPRESSED_FILE);
2760}
2761
1261/*
1262 * this value is set in page as a private data which indicate that
1263 * the page is atomically written, and it is in inmem_pages list.
1264 */
1265#define ATOMIC_WRITTEN_PAGE ((unsigned long)-1)
1266#define DUMMY_WRITTEN_PAGE ((unsigned long)-2)
1267
1268#define IS_ATOMIC_WRITTEN_PAGE(page) \

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

2768}
2769
2770static inline int f2fs_compressed_file(struct inode *inode)
2771{
2772 return S_ISREG(inode->i_mode) &&
2773 is_inode_flag_set(inode, FI_COMPRESSED_FILE);
2774}
2775
2776static inline bool f2fs_need_compress_data(struct inode *inode)
2777{
2778 int compress_mode = F2FS_OPTION(F2FS_I_SB(inode)).compress_mode;
2779
2780 if (!f2fs_compressed_file(inode))
2781 return false;
2782
2783 if (compress_mode == COMPR_MODE_FS)
2784 return true;
2785 else if (compress_mode == COMPR_MODE_USER &&
2786 is_inode_flag_set(inode, FI_ENABLE_COMPRESS))
2787 return true;
2788
2789 return false;
2790}
2791
2762static inline unsigned int addrs_per_inode(struct inode *inode)
2763{
2764 unsigned int addrs = CUR_ADDRS_PER_INODE(inode) -
2765 get_inline_xattr_addrs(inode);
2766
2767 if (!f2fs_compressed_file(inode))
2768 return addrs;
2769 return ALIGN_DOWN(addrs, F2FS_I(inode)->i_cluster_size);

--- 1331 unchanged lines hidden ---
2792static inline unsigned int addrs_per_inode(struct inode *inode)
2793{
2794 unsigned int addrs = CUR_ADDRS_PER_INODE(inode) -
2795 get_inline_xattr_addrs(inode);
2796
2797 if (!f2fs_compressed_file(inode))
2798 return addrs;
2799 return ALIGN_DOWN(addrs, F2FS_I(inode)->i_cluster_size);

--- 1331 unchanged lines hidden ---