Ticket #18502: patch-disk-io.c.diff
File patch-disk-io.c.diff, 1.7 KB (added by 0xffea@…, 16 years ago) |
---|
-
disk-io.c
old new 143 143 device = multi->stripes[0].dev; 144 144 device->total_ios++; 145 145 blocksize = min(blocksize, (u32)(64 * 1024)); 146 #ifdef __APPLE__ 147 read(device->fd, &multi->stripes[0].physical, blocksize); 148 #else 146 149 readahead(device->fd, multi->stripes[0].physical, blocksize); 150 #endif 147 151 kfree(multi); 148 152 return 0; 149 153 } … … 699 703 u64 bytenr; 700 704 701 705 if (sb_bytenr != BTRFS_SUPER_INFO_OFFSET) { 706 #ifdef __APPLE__ 707 ret = pread(fd, &buf, sizeof(buf), sb_bytenr); 708 #else 702 709 ret = pread64(fd, &buf, sizeof(buf), sb_bytenr); 710 #endif 703 711 if (ret < sizeof(buf)) 704 712 return -1; 705 713 … … 714 722 715 723 for (i = 0; i < BTRFS_SUPER_MIRROR_MAX; i++) { 716 724 bytenr = btrfs_sb_offset(i); 725 #ifdef __APPLE__ 726 ret = pread(fd, &buf, sizeof(buf), bytenr); 727 #else 717 728 ret = pread64(fd, &buf, sizeof(buf), bytenr); 729 #endif 718 730 if (ret < sizeof(buf)) 719 731 break; 720 732 … … 747 759 BTRFS_SUPER_INFO_SIZE - BTRFS_CSUM_SIZE); 748 760 btrfs_csum_final(crc, (char *)&sb->csum[0]); 749 761 762 #ifdef __APPLE__ 763 ret = pwrite(device->fd, sb, BTRFS_SUPER_INFO_SIZE, 764 root->fs_info->super_bytenr); 765 #else 750 766 ret = pwrite64(device->fd, sb, BTRFS_SUPER_INFO_SIZE, 751 767 root->fs_info->super_bytenr); 768 #endif 752 769 BUG_ON(ret != BTRFS_SUPER_INFO_SIZE); 753 770 return 0; 754 771 } … … 765 782 BTRFS_SUPER_INFO_SIZE - BTRFS_CSUM_SIZE); 766 783 btrfs_csum_final(crc, (char *)&sb->csum[0]); 767 784 785 #ifdef __APPLE__ 786 ret = pwrite(device->fd, sb, BTRFS_SUPER_INFO_SIZE, bytenr); 787 #else 768 788 ret = pwrite64(device->fd, sb, BTRFS_SUPER_INFO_SIZE, bytenr); 789 #endif 769 790 BUG_ON(ret != BTRFS_SUPER_INFO_SIZE); 770 791 } 771 792 return 0;