diff options
| author | Khem Raj <raj.khem@gmail.com> | 2022-12-15 00:45:45 -0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-12-21 10:16:31 +0000 |
| commit | 76bb16ff6925a1bbec645e6abf730cc81149f223 (patch) | |
| tree | 5ea722542b1f2a2e789c46d3f311829c382505bf /meta/recipes-extended/mdadm | |
| parent | f702fd113aa4ab2ca5bc7940ce88cbd302eaca8b (diff) | |
| download | poky-76bb16ff6925a1bbec645e6abf730cc81149f223.tar.gz | |
mdadm: Use _FILE_OFFSET_BITS to use largefile support
(From OE-Core rev: 5aabfacf7823b90fb61400b670989f77a89c7e5b)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-extended/mdadm')
| -rw-r--r-- | meta/recipes-extended/mdadm/files/0001-restripe.c-Use-_FILE_OFFSET_BITS-to-enable-largefile.patch | 147 | ||||
| -rw-r--r-- | meta/recipes-extended/mdadm/mdadm_4.2.bb | 1 |
2 files changed, 148 insertions, 0 deletions
diff --git a/meta/recipes-extended/mdadm/files/0001-restripe.c-Use-_FILE_OFFSET_BITS-to-enable-largefile.patch b/meta/recipes-extended/mdadm/files/0001-restripe.c-Use-_FILE_OFFSET_BITS-to-enable-largefile.patch new file mode 100644 index 0000000000..142ed355ef --- /dev/null +++ b/meta/recipes-extended/mdadm/files/0001-restripe.c-Use-_FILE_OFFSET_BITS-to-enable-largefile.patch | |||
| @@ -0,0 +1,147 @@ | |||
| 1 | From 6b861a267a6ef6f60f6cc21e4c8e6d7cdd2451dc Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Thu, 10 Nov 2022 12:31:22 -0800 | ||
| 4 | Subject: [PATCH] restripe.c: Use _FILE_OFFSET_BITS to enable largefile support | ||
| 5 | |||
| 6 | Instead of using the lseek64 and friends, its better to enable it via | ||
| 7 | the feature macro _FILE_OFFSET_BITS = 64 and let the C library deal with | ||
| 8 | the width of types | ||
| 9 | |||
| 10 | Upstream-Status: Submitted [https://lore.kernel.org/linux-raid/20221110225546.337164-1-raj.khem@gmail.com/] | ||
| 11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 12 | --- | ||
| 13 | restripe.c | 13 ++++++++----- | ||
| 14 | 1 file changed, 8 insertions(+), 5 deletions(-) | ||
| 15 | |||
| 16 | --- a/restripe.c | ||
| 17 | +++ b/restripe.c | ||
| 18 | @@ -22,6 +22,9 @@ | ||
| 19 | * Email: <neilb@suse.de> | ||
| 20 | */ | ||
| 21 | |||
| 22 | +/* Enable largefile support */ | ||
| 23 | +#define _FILE_OFFSET_BITS 64 | ||
| 24 | + | ||
| 25 | #include "mdadm.h" | ||
| 26 | #include <stdint.h> | ||
| 27 | |||
| 28 | @@ -581,7 +584,7 @@ int save_stripes(int *source, unsigned l | ||
| 29 | raid_disks, level, layout); | ||
| 30 | if (dnum < 0) abort(); | ||
| 31 | if (source[dnum] < 0 || | ||
| 32 | - lseek64(source[dnum], | ||
| 33 | + lseek(source[dnum], | ||
| 34 | offsets[dnum] + offset, 0) < 0 || | ||
| 35 | read(source[dnum], buf+disk * chunk_size, | ||
| 36 | chunk_size) != chunk_size) { | ||
| 37 | @@ -754,8 +757,8 @@ int restore_stripes(int *dest, unsigned | ||
| 38 | raid_disks, level, layout); | ||
| 39 | if (src_buf == NULL) { | ||
| 40 | /* read from file */ | ||
| 41 | - if (lseek64(source, read_offset, 0) != | ||
| 42 | - (off64_t)read_offset) { | ||
| 43 | + if (lseek(source, read_offset, 0) != | ||
| 44 | + (off_t)read_offset) { | ||
| 45 | rv = -1; | ||
| 46 | goto abort; | ||
| 47 | } | ||
| 48 | @@ -816,7 +819,7 @@ int restore_stripes(int *dest, unsigned | ||
| 49 | } | ||
| 50 | for (i=0; i < raid_disks ; i++) | ||
| 51 | if (dest[i] >= 0) { | ||
| 52 | - if (lseek64(dest[i], | ||
| 53 | + if (lseek(dest[i], | ||
| 54 | offsets[i]+offset, 0) < 0) { | ||
| 55 | rv = -1; | ||
| 56 | goto abort; | ||
| 57 | @@ -866,7 +869,7 @@ int test_stripes(int *source, unsigned l | ||
| 58 | int disk; | ||
| 59 | |||
| 60 | for (i = 0 ; i < raid_disks ; i++) { | ||
| 61 | - if ((lseek64(source[i], offsets[i]+start, 0) < 0) || | ||
| 62 | + if ((lseek(source[i], offsets[i]+start, 0) < 0) || | ||
| 63 | (read(source[i], stripes[i], chunk_size) != | ||
| 64 | chunk_size)) { | ||
| 65 | free(q); | ||
| 66 | --- a/raid6check.c | ||
| 67 | +++ b/raid6check.c | ||
| 68 | @@ -22,6 +22,9 @@ | ||
| 69 | * Based on "restripe.c" from "mdadm" codebase | ||
| 70 | */ | ||
| 71 | |||
| 72 | +/* Enable largefile support */ | ||
| 73 | +#define _FILE_OFFSET_BITS 64 | ||
| 74 | + | ||
| 75 | #include "mdadm.h" | ||
| 76 | #include <stdint.h> | ||
| 77 | #include <signal.h> | ||
| 78 | @@ -279,9 +282,9 @@ int manual_repair(int chunk_size, int sy | ||
| 79 | } | ||
| 80 | |||
| 81 | int write_res1, write_res2; | ||
| 82 | - off64_t seek_res; | ||
| 83 | + off_t seek_res; | ||
| 84 | |||
| 85 | - seek_res = lseek64(source[fd1], | ||
| 86 | + seek_res = lseek(source[fd1], | ||
| 87 | offsets[fd1] + start * chunk_size, SEEK_SET); | ||
| 88 | if (seek_res < 0) { | ||
| 89 | fprintf(stderr, "lseek failed for failed_disk1\n"); | ||
| 90 | @@ -289,7 +292,7 @@ int manual_repair(int chunk_size, int sy | ||
| 91 | } | ||
| 92 | write_res1 = write(source[fd1], blocks[failed_slot1], chunk_size); | ||
| 93 | |||
| 94 | - seek_res = lseek64(source[fd2], | ||
| 95 | + seek_res = lseek(source[fd2], | ||
| 96 | offsets[fd2] + start * chunk_size, SEEK_SET); | ||
| 97 | if (seek_res < 0) { | ||
| 98 | fprintf(stderr, "lseek failed for failed_disk2\n"); | ||
| 99 | @@ -374,7 +377,7 @@ int check_stripes(struct mdinfo *info, i | ||
| 100 | goto exitCheck; | ||
| 101 | } | ||
| 102 | for (i = 0 ; i < raid_disks ; i++) { | ||
| 103 | - off64_t seek_res = lseek64(source[i], offsets[i] + start * chunk_size, | ||
| 104 | + off_t seek_res = lseek(source[i], offsets[i] + start * chunk_size, | ||
| 105 | SEEK_SET); | ||
| 106 | if (seek_res < 0) { | ||
| 107 | fprintf(stderr, "lseek to source %d failed\n", i); | ||
| 108 | --- a/swap_super.c | ||
| 109 | +++ b/swap_super.c | ||
| 110 | @@ -1,3 +1,6 @@ | ||
| 111 | +/* Enable largefile support */ | ||
| 112 | +#define _FILE_OFFSET_BITS 64 | ||
| 113 | + | ||
| 114 | #include <unistd.h> | ||
| 115 | #include <stdlib.h> | ||
| 116 | #include <fcntl.h> | ||
| 117 | @@ -16,8 +19,6 @@ | ||
| 118 | |||
| 119 | #define MD_NEW_SIZE_SECTORS(x) ((x & ~(MD_RESERVED_SECTORS - 1)) - MD_RESERVED_SECTORS) | ||
| 120 | |||
| 121 | -extern long long lseek64(int, long long, int); | ||
| 122 | - | ||
| 123 | int main(int argc, char *argv[]) | ||
| 124 | { | ||
| 125 | int fd, i; | ||
| 126 | @@ -38,8 +39,8 @@ int main(int argc, char *argv[]) | ||
| 127 | exit(1); | ||
| 128 | } | ||
| 129 | offset = MD_NEW_SIZE_SECTORS(size) * 512LL; | ||
| 130 | - if (lseek64(fd, offset, 0) < 0LL) { | ||
| 131 | - perror("lseek64"); | ||
| 132 | + if (lseek(fd, offset, 0) < 0LL) { | ||
| 133 | + perror("lseek"); | ||
| 134 | exit(1); | ||
| 135 | } | ||
| 136 | if (read(fd, super, 4096) != 4096) { | ||
| 137 | @@ -68,8 +69,8 @@ int main(int argc, char *argv[]) | ||
| 138 | super[32*4+10*4 +i] = t; | ||
| 139 | } | ||
| 140 | |||
| 141 | - if (lseek64(fd, offset, 0) < 0LL) { | ||
| 142 | - perror("lseek64"); | ||
| 143 | + if (lseek(fd, offset, 0) < 0LL) { | ||
| 144 | + perror("lseek"); | ||
| 145 | exit(1); | ||
| 146 | } | ||
| 147 | if (write(fd, super, 4096) != 4096) { | ||
diff --git a/meta/recipes-extended/mdadm/mdadm_4.2.bb b/meta/recipes-extended/mdadm/mdadm_4.2.bb index 19035caaec..7298860241 100644 --- a/meta/recipes-extended/mdadm/mdadm_4.2.bb +++ b/meta/recipes-extended/mdadm/mdadm_4.2.bb | |||
| @@ -24,6 +24,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/raid/mdadm/${BPN}-${PV}.tar.xz \ | |||
| 24 | file://0001-mdadm-skip-test-11spare-migration.patch \ | 24 | file://0001-mdadm-skip-test-11spare-migration.patch \ |
| 25 | file://0001-Fix-parsing-of-r-in-monitor-manager-mode.patch \ | 25 | file://0001-Fix-parsing-of-r-in-monitor-manager-mode.patch \ |
| 26 | file://0001-Makefile-install-mdcheck.patch \ | 26 | file://0001-Makefile-install-mdcheck.patch \ |
| 27 | file://0001-restripe.c-Use-_FILE_OFFSET_BITS-to-enable-largefile.patch \ | ||
| 27 | " | 28 | " |
| 28 | 29 | ||
| 29 | SRC_URI[sha256sum] = "461c215670864bb74a4d1a3620684aa2b2f8296dffa06743f26dda5557acf01d" | 30 | SRC_URI[sha256sum] = "461c215670864bb74a4d1a3620684aa2b2f8296dffa06743f26dda5557acf01d" |
