internal.h (1758047057dbe329be712a31b79db7151b5871f8) internal.h (ab92184ff8f12979f3d3dd5ed601ed85770d81ba)
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (C) 2017-2018 HUAWEI, Inc.
4 * https://www.huawei.com/
5 * Copyright (C) 2021, Alibaba Cloud
6 */
7#ifndef __EROFS_INTERNAL_H
8#define __EROFS_INTERNAL_H

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

51 char *path;
52 struct block_device *bdev;
53 struct dax_device *dax_dev;
54
55 u32 blocks;
56 u32 mapped_blkaddr;
57};
58
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (C) 2017-2018 HUAWEI, Inc.
4 * https://www.huawei.com/
5 * Copyright (C) 2021, Alibaba Cloud
6 */
7#ifndef __EROFS_INTERNAL_H
8#define __EROFS_INTERNAL_H

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

51 char *path;
52 struct block_device *bdev;
53 struct dax_device *dax_dev;
54
55 u32 blocks;
56 u32 mapped_blkaddr;
57};
58
59enum {
60 EROFS_SYNC_DECOMPRESS_AUTO,
61 EROFS_SYNC_DECOMPRESS_FORCE_ON,
62 EROFS_SYNC_DECOMPRESS_FORCE_OFF
63};
64
59struct erofs_mount_opts {
60#ifdef CONFIG_EROFS_FS_ZIP
61 /* current strategy of how to use managed cache */
62 unsigned char cache_strategy;
65struct erofs_mount_opts {
66#ifdef CONFIG_EROFS_FS_ZIP
67 /* current strategy of how to use managed cache */
68 unsigned char cache_strategy;
63 /* strategy of sync decompression (false - auto, true - force on) */
64 bool readahead_sync_decompress;
69 /* strategy of sync decompression (0 - auto, 1 - force on, 2 - force off) */
70 unsigned int sync_decompress;
65
66 /* threshold for decompression synchronously */
67 unsigned int max_sync_decompress_pages;
68#endif
69 unsigned int mount_opt;
70};
71
72struct erofs_dev_context {

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

129 erofs_nid_t root_nid;
130 /* used for statfs, f_files - f_favail */
131 u64 inos;
132
133 u8 uuid[16]; /* 128-bit uuid for volume */
134 u8 volume_name[16]; /* volume name */
135 u32 feature_compat;
136 u32 feature_incompat;
71
72 /* threshold for decompression synchronously */
73 unsigned int max_sync_decompress_pages;
74#endif
75 unsigned int mount_opt;
76};
77
78struct erofs_dev_context {

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

135 erofs_nid_t root_nid;
136 /* used for statfs, f_files - f_favail */
137 u64 inos;
138
139 u8 uuid[16]; /* 128-bit uuid for volume */
140 u8 volume_name[16]; /* volume name */
141 u32 feature_compat;
142 u32 feature_incompat;
143
144 /* sysfs support */
145 struct kobject s_kobj; /* /sys/fs/erofs/<devname> */
146 struct completion s_kobj_unregister;
137};
138
139#define EROFS_SB(sb) ((struct erofs_sb_info *)(sb)->s_fs_info)
140#define EROFS_I_SB(inode) ((struct erofs_sb_info *)(inode)->i_sb->s_fs_info)
141
142/* Mount flags set via mount options or defaults */
143#define EROFS_MOUNT_XATTR_USER 0x00000010
144#define EROFS_MOUNT_POSIX_ACL 0x00000020

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

253}
254
255#define EROFS_FEATURE_FUNCS(name, compat, feature) \
256static inline bool erofs_sb_has_##name(struct erofs_sb_info *sbi) \
257{ \
258 return sbi->feature_##compat & EROFS_FEATURE_##feature; \
259}
260
147};
148
149#define EROFS_SB(sb) ((struct erofs_sb_info *)(sb)->s_fs_info)
150#define EROFS_I_SB(inode) ((struct erofs_sb_info *)(inode)->i_sb->s_fs_info)
151
152/* Mount flags set via mount options or defaults */
153#define EROFS_MOUNT_XATTR_USER 0x00000010
154#define EROFS_MOUNT_POSIX_ACL 0x00000020

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

263}
264
265#define EROFS_FEATURE_FUNCS(name, compat, feature) \
266static inline bool erofs_sb_has_##name(struct erofs_sb_info *sbi) \
267{ \
268 return sbi->feature_##compat & EROFS_FEATURE_##feature; \
269}
270
261EROFS_FEATURE_FUNCS(lz4_0padding, incompat, INCOMPAT_LZ4_0PADDING)
271EROFS_FEATURE_FUNCS(zero_padding, incompat, INCOMPAT_ZERO_PADDING)
262EROFS_FEATURE_FUNCS(compr_cfgs, incompat, INCOMPAT_COMPR_CFGS)
263EROFS_FEATURE_FUNCS(big_pcluster, incompat, INCOMPAT_BIG_PCLUSTER)
272EROFS_FEATURE_FUNCS(compr_cfgs, incompat, INCOMPAT_COMPR_CFGS)
273EROFS_FEATURE_FUNCS(big_pcluster, incompat, INCOMPAT_BIG_PCLUSTER)
274EROFS_FEATURE_FUNCS(chunked_file, incompat, INCOMPAT_CHUNKED_FILE)
264EROFS_FEATURE_FUNCS(device_table, incompat, INCOMPAT_DEVICE_TABLE)
275EROFS_FEATURE_FUNCS(device_table, incompat, INCOMPAT_DEVICE_TABLE)
276EROFS_FEATURE_FUNCS(compr_head2, incompat, INCOMPAT_COMPR_HEAD2)
277EROFS_FEATURE_FUNCS(ztailpacking, incompat, INCOMPAT_ZTAILPACKING)
265EROFS_FEATURE_FUNCS(sb_chksum, compat, COMPAT_SB_CHKSUM)
266
267/* atomic flag definitions */
268#define EROFS_I_EA_INITED_BIT 0
269#define EROFS_I_Z_INITED_BIT 1
270
271/* bitlock definitions (arranged in reverse order) */
272#define EROFS_I_BL_XATTR_BIT (BITS_PER_LONG - 1)

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

291 unsigned short chunkformat;
292 unsigned char chunkbits;
293 };
294#ifdef CONFIG_EROFS_FS_ZIP
295 struct {
296 unsigned short z_advise;
297 unsigned char z_algorithmtype[2];
298 unsigned char z_logical_clusterbits;
278EROFS_FEATURE_FUNCS(sb_chksum, compat, COMPAT_SB_CHKSUM)
279
280/* atomic flag definitions */
281#define EROFS_I_EA_INITED_BIT 0
282#define EROFS_I_Z_INITED_BIT 1
283
284/* bitlock definitions (arranged in reverse order) */
285#define EROFS_I_BL_XATTR_BIT (BITS_PER_LONG - 1)

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

304 unsigned short chunkformat;
305 unsigned char chunkbits;
306 };
307#ifdef CONFIG_EROFS_FS_ZIP
308 struct {
309 unsigned short z_advise;
310 unsigned char z_algorithmtype[2];
311 unsigned char z_logical_clusterbits;
312 unsigned long z_tailextent_headlcn;
313 unsigned int z_idataoff;
314 unsigned short z_idata_size;
299 };
300#endif /* CONFIG_EROFS_FS_ZIP */
301 };
302 /* the corresponding vfs inode */
303 struct inode vfs_inode;
304};
305
306#define EROFS_I(ptr) \

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

404#define EROFS_GET_BLOCKS_RAW 0x0001
405/*
406 * Used to get the exact decompressed length, e.g. fiemap (consider lookback
407 * approach instead if possible since it's more metadata lightweight.)
408 */
409#define EROFS_GET_BLOCKS_FIEMAP 0x0002
410/* Used to map the whole extent if non-negligible data is requested for LZMA */
411#define EROFS_GET_BLOCKS_READMORE 0x0004
315 };
316#endif /* CONFIG_EROFS_FS_ZIP */
317 };
318 /* the corresponding vfs inode */
319 struct inode vfs_inode;
320};
321
322#define EROFS_I(ptr) \

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

420#define EROFS_GET_BLOCKS_RAW 0x0001
421/*
422 * Used to get the exact decompressed length, e.g. fiemap (consider lookback
423 * approach instead if possible since it's more metadata lightweight.)
424 */
425#define EROFS_GET_BLOCKS_FIEMAP 0x0002
426/* Used to map the whole extent if non-negligible data is requested for LZMA */
427#define EROFS_GET_BLOCKS_READMORE 0x0004
428/* Used to map tail extent for tailpacking inline pcluster */
429#define EROFS_GET_BLOCKS_FINDTAIL 0x0008
412
413enum {
414 Z_EROFS_COMPRESSION_SHIFTED = Z_EROFS_COMPRESSION_MAX,
415 Z_EROFS_COMPRESSION_RUNTIME_MAX
416};
417
418/* zmap.c */
419extern const struct iomap_ops z_erofs_iomap_report_ops;

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

493
494/* pcpubuf.c */
495void *erofs_get_pcpubuf(unsigned int requiredpages);
496void erofs_put_pcpubuf(void *ptr);
497int erofs_pcpubuf_growsize(unsigned int nrpages);
498void erofs_pcpubuf_init(void);
499void erofs_pcpubuf_exit(void);
500
430
431enum {
432 Z_EROFS_COMPRESSION_SHIFTED = Z_EROFS_COMPRESSION_MAX,
433 Z_EROFS_COMPRESSION_RUNTIME_MAX
434};
435
436/* zmap.c */
437extern const struct iomap_ops z_erofs_iomap_report_ops;

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

511
512/* pcpubuf.c */
513void *erofs_get_pcpubuf(unsigned int requiredpages);
514void erofs_put_pcpubuf(void *ptr);
515int erofs_pcpubuf_growsize(unsigned int nrpages);
516void erofs_pcpubuf_init(void);
517void erofs_pcpubuf_exit(void);
518
519/* sysfs.c */
520int erofs_register_sysfs(struct super_block *sb);
521void erofs_unregister_sysfs(struct super_block *sb);
522int __init erofs_init_sysfs(void);
523void erofs_exit_sysfs(void);
524
501/* utils.c / zdata.c */
502struct page *erofs_allocpage(struct page **pagepool, gfp_t gfp);
503static inline void erofs_pagepool_add(struct page **pagepool,
504 struct page *page)
505{
506 set_page_private(page, (unsigned long)*pagepool);
507 *pagepool = page;
508}

--- 63 unchanged lines hidden ---
525/* utils.c / zdata.c */
526struct page *erofs_allocpage(struct page **pagepool, gfp_t gfp);
527static inline void erofs_pagepool_add(struct page **pagepool,
528 struct page *page)
529{
530 set_page_private(page, (unsigned long)*pagepool);
531 *pagepool = page;
532}

--- 63 unchanged lines hidden ---