diff --git a/kernel/compat.h b/kernel/compat.h index 1baa9755..214c0af8 100644 --- a/kernel/compat.h +++ b/kernel/compat.h @@ -131,6 +131,15 @@ extern int __oldcompat_unlink( #include #endif +/* Adapt to 3d745ea5b095a3985129e162900b7e6c22518a9d + * detected via 9243c6f3e012a92dd900d97ef45efaf8a8edc448 + * and see its comment. + */ +#if !defined(GENHD_FL_MEDIA_CHANGE_NOTIFY) || \ + defined(IOCB_WAITQ) +#define MARS_NEW_BLK_ALLOC_QUEUE +#endif + /* Detect upstream commits * 2a842acab109f40f0d7d10b38e9ca88390628996 * 4e4cbee93d56137ebff722be022cae5f70ef84fb diff --git a/kernel/mars_if.c b/kernel/mars_if.c index 1a683161..b0a83204 100644 --- a/kernel/mars_if.c +++ b/kernel/mars_if.c @@ -1066,7 +1066,17 @@ static int if_switch(struct if_brick *brick) #endif status = -ENOMEM; +#ifdef MARS_NEW_BLK_ALLOC_QUEUE + /* Moved from obsolete blk_queue_make_request() to here. + * See 3d745ea5b095a3985129e162900b7e6c22518a9d + * and many thanks to Christoph Hellwig! + */ + q = blk_alloc_queue(if_make_request, GFP_MARS); +#else + /* old code before 3d745ea5b095a3985129e162900b7e6c22518a9d + */ q = blk_alloc_queue(GFP_MARS); +#endif if (!q) { MARS_ERR("cannot allocate device request queue\n"); goto is_down; @@ -1093,8 +1103,16 @@ static int if_switch(struct if_brick *brick) capacity = if_get_capacity(brick); MARS_DBG("created device name %s, capacity=%lld\n", disk->disk_name, capacity); if_set_capacity(input, capacity); - + +#ifdef MARS_NEW_BLK_ALLOC_QUEUE + /* No longer called right here. + * Moved to blk_alloc_queue(), see 3d745ea5b095a3985129e162900b7e6c22518a9d + * and many thanks to Christoph Hellwig! + */ +#else blk_queue_make_request(q, if_make_request); +#endif + #ifdef USE_MAX_SECTORS #ifdef MAX_SEGMENT_SIZE MARS_DBG("blk_queue_max_sectors()\n");