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