mirror of
https://github.com/schoebel/mars
synced 2025-03-31 07:46:57 +00:00
infra: adapt to block layer changes, kernel 4.11
This commit is contained in:
parent
d09ab9ab1e
commit
1dcd705e16
@ -71,6 +71,20 @@ extern int _compat_unlink(
|
||||
#define MARS_HAS_BVEC_ITER
|
||||
#endif
|
||||
|
||||
/* Detect upstream commits
|
||||
* dc3b17cc8bf21307c7e076e7c778d5db756f7871
|
||||
* d03f6cdc1fc422accb734c7c07a661a0018d8631
|
||||
* b1d2dc5659b41741f5a29b2ade76ffb4e5bb13d8
|
||||
* via fd2d332677c687ca90c12a47d6c377c547100b56
|
||||
*/
|
||||
#include <linux/blkdev.h>
|
||||
#ifdef BLK_QC_T_INTERNAL
|
||||
#define MARS_HAS_BDI_GET
|
||||
#endif
|
||||
#ifdef MARS_HAS_BDI_GET
|
||||
#include <linux/backing-dev.h>
|
||||
#endif
|
||||
|
||||
/* adaptation to 4246a0b63bd8f56a1469b12eafeb875b1041a451 and 8ae126660fddbeebb9251a174e6fa45b6ad8f932 */
|
||||
#ifndef bio_io_error
|
||||
#define MARS_HAS_BI_ERROR
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include <linux/string.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/file.h>
|
||||
@ -215,8 +214,16 @@ struct mapfree_info *mapfree_get(const char *name, int flags)
|
||||
}
|
||||
|
||||
if (S_ISBLK(inode->i_mode)) {
|
||||
#ifdef MARS_HAS_BDI_GET
|
||||
struct backing_dev_info *bdi =
|
||||
I_BDEV(inode)->bd_bdi;
|
||||
MARS_INF("changing blkdev readahead from %lu to %d\n",
|
||||
bdi->ra_pages, ra);
|
||||
bdi->ra_pages = ra;
|
||||
#else /* deprecated old code */
|
||||
MARS_INF("changing blkdev readahead from %lu to %d\n", inode->i_bdev->bd_disk->queue->backing_dev_info.ra_pages, ra);
|
||||
inode->i_bdev->bd_disk->queue->backing_dev_info.ra_pages = ra;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (flags & O_DIRECT) { // never share them
|
||||
|
@ -791,6 +791,9 @@ static int bio_switch(struct bio_brick *brick)
|
||||
struct address_space *mapping;
|
||||
struct inode *inode;
|
||||
struct request_queue *q;
|
||||
#ifdef MARS_HAS_BDI_GET
|
||||
struct backing_dev_info *bdi;
|
||||
#endif
|
||||
|
||||
brick->mf = mapfree_get(path, flags);
|
||||
if (unlikely(!brick->mf)) {
|
||||
@ -820,8 +823,15 @@ static int bio_switch(struct bio_brick *brick)
|
||||
goto done;
|
||||
}
|
||||
|
||||
#ifdef MARS_HAS_BDI_GET
|
||||
bdi = I_BDEV(inode)->bd_bdi;
|
||||
MARS_INF("'%s' ra_pages OLD=%lu NEW=%d\n", path,
|
||||
bdi->ra_pages, brick->ra_pages);
|
||||
bdi->ra_pages = brick->ra_pages;
|
||||
#else
|
||||
MARS_INF("'%s' ra_pages OLD=%lu NEW=%d\n", path, q->backing_dev_info.ra_pages, brick->ra_pages);
|
||||
q->backing_dev_info.ra_pages = brick->ra_pages;
|
||||
#endif
|
||||
|
||||
q->nr_requests = bio_nr_requests;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user