btrfs: switch write_buf to kernel_write

Instead of playing with the addressing limits.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

authored by

Christoph Hellwig and committed by
Al Viro
8e93157b 670986ec

+4 -14
+4 -14
fs/btrfs/send.c
··· 539 static int write_buf(struct file *filp, const void *buf, u32 len, loff_t *off) 540 { 541 int ret; 542 - mm_segment_t old_fs; 543 u32 pos = 0; 544 545 - old_fs = get_fs(); 546 - set_fs(KERNEL_DS); 547 - 548 while (pos < len) { 549 - ret = vfs_write(filp, (__force const char __user *)buf + pos, 550 - len - pos, off); 551 /* TODO handle that correctly */ 552 /*if (ret == -ERESTARTSYS) { 553 continue; 554 }*/ 555 if (ret < 0) 556 - goto out; 557 if (ret == 0) { 558 - ret = -EIO; 559 - goto out; 560 } 561 pos += ret; 562 } 563 564 - ret = 0; 565 - 566 - out: 567 - set_fs(old_fs); 568 - return ret; 569 } 570 571 static int tlv_put(struct send_ctx *sctx, u16 attr, const void *data, int len)
··· 539 static int write_buf(struct file *filp, const void *buf, u32 len, loff_t *off) 540 { 541 int ret; 542 u32 pos = 0; 543 544 while (pos < len) { 545 + ret = kernel_write(filp, buf + pos, len - pos, off); 546 /* TODO handle that correctly */ 547 /*if (ret == -ERESTARTSYS) { 548 continue; 549 }*/ 550 if (ret < 0) 551 + return ret; 552 if (ret == 0) { 553 + return -EIO; 554 } 555 pos += ret; 556 } 557 558 + return 0; 559 } 560 561 static int tlv_put(struct send_ctx *sctx, u16 attr, const void *data, int len)