diff options
author | Anand Jain <anand.jain@oracle.com> | 2012-09-14 02:04:21 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2012-10-04 09:39:55 -0400 |
commit | 1bcea35597693b3ac1ec1b311cfd42d52972a710 (patch) | |
tree | fa1d8d7888c8a2aee895510f66c92ccd12308b11 /fs/btrfs/send.c | |
parent | b4f359ab065b9c6c132124557d23e90e2e8504be (diff) |
Btrfs: write_buf is now callable outside send.c
Developing service cmds needs it.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Diffstat (limited to 'fs/btrfs/send.c')
-rw-r--r-- | fs/btrfs/send.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index c6ef070a8dca..c7beb543a4a8 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c | |||
@@ -386,7 +386,7 @@ static struct btrfs_path *alloc_path_for_send(void) | |||
386 | return path; | 386 | return path; |
387 | } | 387 | } |
388 | 388 | ||
389 | static int write_buf(struct send_ctx *sctx, const void *buf, u32 len) | 389 | int write_buf(struct file *filp, const void *buf, u32 len, loff_t *off) |
390 | { | 390 | { |
391 | int ret; | 391 | int ret; |
392 | mm_segment_t old_fs; | 392 | mm_segment_t old_fs; |
@@ -396,8 +396,7 @@ static int write_buf(struct send_ctx *sctx, const void *buf, u32 len) | |||
396 | set_fs(KERNEL_DS); | 396 | set_fs(KERNEL_DS); |
397 | 397 | ||
398 | while (pos < len) { | 398 | while (pos < len) { |
399 | ret = vfs_write(sctx->send_filp, (char *)buf + pos, len - pos, | 399 | ret = vfs_write(filp, (char *)buf + pos, len - pos, off); |
400 | &sctx->send_off); | ||
401 | /* TODO handle that correctly */ | 400 | /* TODO handle that correctly */ |
402 | /*if (ret == -ERESTARTSYS) { | 401 | /*if (ret == -ERESTARTSYS) { |
403 | continue; | 402 | continue; |
@@ -553,7 +552,8 @@ static int send_header(struct send_ctx *sctx) | |||
553 | strcpy(hdr.magic, BTRFS_SEND_STREAM_MAGIC); | 552 | strcpy(hdr.magic, BTRFS_SEND_STREAM_MAGIC); |
554 | hdr.version = cpu_to_le32(BTRFS_SEND_STREAM_VERSION); | 553 | hdr.version = cpu_to_le32(BTRFS_SEND_STREAM_VERSION); |
555 | 554 | ||
556 | return write_buf(sctx, &hdr, sizeof(hdr)); | 555 | return write_buf(sctx->send_filp, &hdr, sizeof(hdr), |
556 | &sctx->send_off); | ||
557 | } | 557 | } |
558 | 558 | ||
559 | /* | 559 | /* |
@@ -590,7 +590,8 @@ static int send_cmd(struct send_ctx *sctx) | |||
590 | crc = crc32c(0, (unsigned char *)sctx->send_buf, sctx->send_size); | 590 | crc = crc32c(0, (unsigned char *)sctx->send_buf, sctx->send_size); |
591 | hdr->crc = cpu_to_le32(crc); | 591 | hdr->crc = cpu_to_le32(crc); |
592 | 592 | ||
593 | ret = write_buf(sctx, sctx->send_buf, sctx->send_size); | 593 | ret = write_buf(sctx->send_filp, sctx->send_buf, sctx->send_size, |
594 | &sctx->send_off); | ||
594 | 595 | ||
595 | sctx->total_send_size += sctx->send_size; | 596 | sctx->total_send_size += sctx->send_size; |
596 | sctx->cmd_send_size[le16_to_cpu(hdr->cmd)] += sctx->send_size; | 597 | sctx->cmd_send_size[le16_to_cpu(hdr->cmd)] += sctx->send_size; |