aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'fs/f2fs/f2fs.h')
-rw-r--r--fs/f2fs/f2fs.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 0d25f5ca5618..0b314b2034d8 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -147,7 +147,8 @@ struct f2fs_mount_info {
147 147
148 /* For compression */ 148 /* For compression */
149 unsigned char compress_algorithm; /* algorithm type */ 149 unsigned char compress_algorithm; /* algorithm type */
150 unsigned compress_log_size; /* cluster log size */ 150 unsigned char compress_log_size; /* cluster log size */
151 bool compress_chksum; /* compressed data chksum */
151 unsigned char compress_ext_cnt; /* extension count */ 152 unsigned char compress_ext_cnt; /* extension count */
152 unsigned char extensions[COMPRESS_EXT_NUM][F2FS_EXTENSION_LEN]; /* extensions */ 153 unsigned char extensions[COMPRESS_EXT_NUM][F2FS_EXTENSION_LEN]; /* extensions */
153}; 154};
@@ -676,6 +677,7 @@ enum {
676 FI_ATOMIC_REVOKE_REQUEST, /* request to drop atomic data */ 677 FI_ATOMIC_REVOKE_REQUEST, /* request to drop atomic data */
677 FI_VERITY_IN_PROGRESS, /* building fs-verity Merkle tree */ 678 FI_VERITY_IN_PROGRESS, /* building fs-verity Merkle tree */
678 FI_COMPRESSED_FILE, /* indicate file's data can be compressed */ 679 FI_COMPRESSED_FILE, /* indicate file's data can be compressed */
680 FI_COMPRESS_CORRUPT, /* indicate compressed cluster is corrupted */
679 FI_MMAP_FILE, /* indicate file was mmapped */ 681 FI_MMAP_FILE, /* indicate file was mmapped */
680 FI_MAX, /* max flag, never be used */ 682 FI_MAX, /* max flag, never be used */
681}; 683};
@@ -733,6 +735,7 @@ struct f2fs_inode_info {
733 atomic_t i_compr_blocks; /* # of compressed blocks */ 735 atomic_t i_compr_blocks; /* # of compressed blocks */
734 unsigned char i_compress_algorithm; /* algorithm type */ 736 unsigned char i_compress_algorithm; /* algorithm type */
735 unsigned char i_log_cluster_size; /* log of cluster size */ 737 unsigned char i_log_cluster_size; /* log of cluster size */
738 unsigned short i_compress_flag; /* compress flag */
736 unsigned int i_cluster_size; /* cluster size */ 739 unsigned int i_cluster_size; /* cluster size */
737}; 740};
738 741
@@ -1272,9 +1275,15 @@ enum compress_algorithm_type {
1272 COMPRESS_MAX, 1275 COMPRESS_MAX,
1273}; 1276};
1274 1277
1275#define COMPRESS_DATA_RESERVED_SIZE 5 1278enum compress_flag {
1279 COMPRESS_CHKSUM,
1280 COMPRESS_MAX_FLAG,
1281};
1282
1283#define COMPRESS_DATA_RESERVED_SIZE 4
1276struct compress_data { 1284struct compress_data {
1277 __le32 clen; /* compressed data size */ 1285 __le32 clen; /* compressed data size */
1286 __le32 chksum; /* compressed data chksum */
1278 __le32 reserved[COMPRESS_DATA_RESERVED_SIZE]; /* reserved */ 1287 __le32 reserved[COMPRESS_DATA_RESERVED_SIZE]; /* reserved */
1279 u8 cdata[]; /* compressed data */ 1288 u8 cdata[]; /* compressed data */
1280}; 1289};
@@ -3888,6 +3897,9 @@ static inline void set_compress_context(struct inode *inode)
3888 F2FS_OPTION(sbi).compress_algorithm; 3897 F2FS_OPTION(sbi).compress_algorithm;
3889 F2FS_I(inode)->i_log_cluster_size = 3898 F2FS_I(inode)->i_log_cluster_size =
3890 F2FS_OPTION(sbi).compress_log_size; 3899 F2FS_OPTION(sbi).compress_log_size;
3900 F2FS_I(inode)->i_compress_flag =
3901 F2FS_OPTION(sbi).compress_chksum ?
3902 1 << COMPRESS_CHKSUM : 0;
3891 F2FS_I(inode)->i_cluster_size = 3903 F2FS_I(inode)->i_cluster_size =
3892 1 << F2FS_I(inode)->i_log_cluster_size; 3904 1 << F2FS_I(inode)->i_log_cluster_size;
3893 F2FS_I(inode)->i_flags |= F2FS_COMPR_FL; 3905 F2FS_I(inode)->i_flags |= F2FS_COMPR_FL;