@@ -1178,8 +1178,8 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
again:
dev = &sh->dev[i];
- bi = &dev->req;
- rbi = &dev->rreq; /* For writing to replacement */
+ bi = container_of(&dev->req, struct bio, __hdr);
+ rbi = container_of(&dev->rreq, struct bio, __hdr); /* For writing to replacement */
rdev = conf->disks[i].rdev;
rrdev = conf->disks[i].replacement;
@@ -2720,7 +2720,7 @@ static void raid5_end_read_request(struct bio * bi)
sector_t s;
for (i=0 ; i<disks; i++)
- if (bi == &sh->dev[i].req)
+ if (bi == container_of(&sh->dev[i].req, struct bio, __hdr))
break;
pr_debug("end_read_request %llu/%d, count: %d, error %d.\n",
@@ -2848,11 +2848,11 @@ static void raid5_end_write_request(struct bio *bi)
int replacement = 0;
for (i = 0 ; i < disks; i++) {
- if (bi == &sh->dev[i].req) {
+ if (bi == container_of(&sh->dev[i].req, struct bio, __hdr)) {
rdev = conf->disks[i].rdev;
break;
}
- if (bi == &sh->dev[i].rreq) {
+ if (bi == container_of(&sh->dev[i].rreq, struct bio, __hdr)) {
rdev = conf->disks[i].replacement;
if (rdev)
replacement = 1;
@@ -259,7 +259,7 @@ struct stripe_head {
/* rreq and rvec are used for the replacement device when
* writing data to both devices.
*/
- struct bio req, rreq;
+ struct bio_hdr req, rreq;
struct bio_vec vec, rvec;
struct page *page, *orig_page;
unsigned int offset; /* offset of the page */
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally. Change the type of the middle struct members currently causing trouble from `struct bio` to `struct bio_hdr`. We also use `container_of()` whenever we need to retrieve a pointer to the flexible structure `struct bio`, through which we can access the flexible-array member in it, if necessary. With these changes fix 10 of the following warnings: drivers/md/raid5.h:262:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] drivers/md/raid5.h:262:38: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> --- drivers/md/raid5.c | 10 +++++----- drivers/md/raid5.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-)