diff options
author | Gao Xiang <gaoxiang25@huawei.com> | 2019-09-26 12:15:15 +0800 |
---|---|---|
committer | Gao Xiang <hsiangkao@aol.com> | 2019-10-06 13:21:10 +0800 |
commit | b0ca535297b6dfb1026fd1618a67571ccbcbe8e4 (patch) | |
tree | eb532922b5dfba3df097cb974f5d6d056bdde697 /include | |
parent | fbba92dc493401dec79c902580f6ac2101660eb9 (diff) | |
download | erofs-utils-b0ca535297b6dfb1026fd1618a67571ccbcbe8e4.tar.gz |
erofs-utils: support 64-bit internal buffer cache
Previously, the type of off in struct erofs_buffer_head
is unsigned int, it's not enough for large files.
Fix to a 64-bit field in order to support large files.
Reviewed-by: Li Guifu <blucerlee@gmail.com>
Tested-by: Li Guifu <blucerlee@gmail.com>
Link: https://lore.kernel.org/r/20191004204630.22696-1-hsiangkao@aol.com
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/erofs/cache.h | 8 | ||||
-rw-r--r-- | include/erofs/defs.h | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/include/erofs/cache.h b/include/erofs/cache.h index 71df811..10a6aac 100644 --- a/include/erofs/cache.h +++ b/include/erofs/cache.h @@ -31,7 +31,7 @@ struct erofs_buffer_head { struct list_head list; struct erofs_buffer_block *block; - unsigned int off; + erofs_off_t off; struct erofs_bhops *op; void *fsprivate; @@ -87,13 +87,13 @@ static inline bool erofs_bh_flush_generic_end(struct erofs_buffer_head *bh) } struct erofs_buffer_head *erofs_buffer_init(void); -int erofs_bh_balloon(struct erofs_buffer_head *bh, unsigned int incr); +int erofs_bh_balloon(struct erofs_buffer_head *bh, erofs_off_t incr); -struct erofs_buffer_head *erofs_balloc(int type, unsigned int size, +struct erofs_buffer_head *erofs_balloc(int type, erofs_off_t size, unsigned int required_ext, unsigned int inline_ext); struct erofs_buffer_head *erofs_battach(struct erofs_buffer_head *bh, - int type, int size); + int type, unsigned int size); erofs_blk_t erofs_mapbh(struct erofs_buffer_block *bb, bool end); bool erofs_bflush(struct erofs_buffer_block *bb); diff --git a/include/erofs/defs.h b/include/erofs/defs.h index 0d9910c..15db4e3 100644 --- a/include/erofs/defs.h +++ b/include/erofs/defs.h @@ -136,6 +136,10 @@ typedef int64_t s64; type __max2 = (y); \ __max1 > __max2 ? __max1: __max2; }) +#define sgn(x) ({ \ + typeof(x) _x = (x); \ +(_x > 0) - (_x < 0); }) + #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) #define BIT(nr) (1UL << (nr)) |