diff mbox series

btrfs: add macro BTRFS_SEND_BUF_SIZE_V2

Message ID 20221019081001.58288-1-wangyugui@e16-tech.com (mailing list archive)
State New, archived
Headers show
Series btrfs: add macro BTRFS_SEND_BUF_SIZE_V2 | expand

Commit Message

Wang Yugui Oct. 19, 2022, 8:10 a.m. UTC
Add a macro BTRFS_SEND_BUF_SIZE_V2 and save it just after
BTRFS_SEND_BUF_SIZE_V1.

This is a refactor without any function change.

Signed-off-by: Wang Yugui <wangyugui@e16-tech.com>
---
 fs/btrfs/send.c | 2 +-
 fs/btrfs/send.h | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

Comments

David Sterba Oct. 19, 2022, 3:33 p.m. UTC | #1
On Wed, Oct 19, 2022 at 04:10:01PM +0800, Wang Yugui wrote:
> Add a macro BTRFS_SEND_BUF_SIZE_V2 and save it just after
> BTRFS_SEND_BUF_SIZE_V1.
> 
> This is a refactor without any function change.
> 
> Signed-off-by: Wang Yugui <wangyugui@e16-tech.com>

Added to misc-next, thanks.
diff mbox series

Patch

diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index ec6e1752af2c..d7eabff2c0b7 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -7877,7 +7877,7 @@  long btrfs_ioctl_send(struct inode *inode, struct btrfs_ioctl_send_args *arg)
 	if (sctx->proto >= 2) {
 		u32 send_buf_num_pages;
 
-		sctx->send_max_size = ALIGN(SZ_16K + BTRFS_MAX_COMPRESSED, PAGE_SIZE);
+		sctx->send_max_size = BTRFS_SEND_BUF_SIZE_V2;
 		sctx->send_buf = vmalloc(sctx->send_max_size);
 		if (!sctx->send_buf) {
 			ret = -ENOMEM;
diff --git a/fs/btrfs/send.h b/fs/btrfs/send.h
index f7585cfa7e52..22f055256408 100644
--- a/fs/btrfs/send.h
+++ b/fs/btrfs/send.h
@@ -21,7 +21,8 @@ 
  * In send stream v1, no command is larger than 64K. In send stream v2, no limit
  * should be assumed.
  */
-#define BTRFS_SEND_BUF_SIZE_V1				SZ_64K
+#define BTRFS_SEND_BUF_SIZE_V1	SZ_64K
+#define BTRFS_SEND_BUF_SIZE_V2	ALIGN(SZ_16K + BTRFS_MAX_COMPRESSED, PAGE_SIZE)
 
 struct inode;
 struct btrfs_ioctl_send_args;