diff options
Diffstat (limited to 'fs/btrfs/compression.h')
| -rw-r--r-- | fs/btrfs/compression.h | 46 | 
1 files changed, 7 insertions, 39 deletions
diff --git a/fs/btrfs/compression.h b/fs/btrfs/compression.h index 4cb8be9ff88b..d253f7aa8ed5 100644 --- a/fs/btrfs/compression.h +++ b/fs/btrfs/compression.h @@ -93,7 +93,8 @@ blk_status_t btrfs_submit_compressed_write(struct inode *inode, u64 start,  				  unsigned long compressed_len,  				  struct page **compressed_pages,  				  unsigned long nr_pages, -				  unsigned int write_flags); +				  unsigned int write_flags, +				  struct cgroup_subsys_state *blkcg_css);  blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,  				 int mirror_num, unsigned long bio_flags); @@ -104,11 +105,10 @@ enum btrfs_compression_type {  	BTRFS_COMPRESS_ZLIB  = 1,  	BTRFS_COMPRESS_LZO   = 2,  	BTRFS_COMPRESS_ZSTD  = 3, -	BTRFS_COMPRESS_TYPES = 3, +	BTRFS_NR_COMPRESS_TYPES = 4,  };  struct workspace_manager { -	const struct btrfs_compress_op *ops;  	struct list_head idle_ws;  	spinlock_t ws_lock;  	/* Number of free workspaces */ @@ -119,50 +119,18 @@ struct workspace_manager {  	wait_queue_head_t ws_wait;  }; -void btrfs_init_workspace_manager(struct workspace_manager *wsm, -				  const struct btrfs_compress_op *ops); -struct list_head *btrfs_get_workspace(struct workspace_manager *wsm, -				      unsigned int level); -void btrfs_put_workspace(struct workspace_manager *wsm, struct list_head *ws); -void btrfs_cleanup_workspace_manager(struct workspace_manager *wsm); +struct list_head *btrfs_get_workspace(int type, unsigned int level); +void btrfs_put_workspace(int type, struct list_head *ws);  struct btrfs_compress_op { -	void (*init_workspace_manager)(void); - -	void (*cleanup_workspace_manager)(void); - -	struct list_head *(*get_workspace)(unsigned int level); - -	void (*put_workspace)(struct list_head *ws); - -	struct list_head *(*alloc_workspace)(unsigned int level); - -	void (*free_workspace)(struct list_head *workspace); - -	int (*compress_pages)(struct list_head *workspace, -			      struct address_space *mapping, -			      u64 start, -			      struct page **pages, -			      unsigned long *out_pages, -			      unsigned long *total_in, -			      unsigned long *total_out); - -	int (*decompress_bio)(struct list_head *workspace, -				struct compressed_bio *cb); - -	int (*decompress)(struct list_head *workspace, -			  unsigned char *data_in, -			  struct page *dest_page, -			  unsigned long start_byte, -			  size_t srclen, size_t destlen); - +	struct workspace_manager *workspace_manager;  	/* Maximum level supported by the compression algorithm */  	unsigned int max_level;  	unsigned int default_level;  };  /* The heuristic workspaces are managed via the 0th workspace manager */ -#define BTRFS_NR_WORKSPACE_MANAGERS	(BTRFS_COMPRESS_TYPES + 1) +#define BTRFS_NR_WORKSPACE_MANAGERS	BTRFS_NR_COMPRESS_TYPES  extern const struct btrfs_compress_op btrfs_heuristic_compress;  extern const struct btrfs_compress_op btrfs_zlib_compress;  |