Skip to content

Commit 7a862fb

Browse files
committed
brd: remove dax support
DAX support in brd is awkward because its backing page frames are distinct from the ones provided by pmem, dcssblk, or axonram. We need pfn_t_devmap() entries to fully support DAX, and the limited DAX support for pfn_t_special() page frames is not interesting for brd when pmem is already a superset of brd. Lastly, brd is the only dax capable driver that may sleep in its ->direct_access() implementation. So it causes a global burden with no net gain of kernel functionality. For all these reasons, remove DAX support. Cc: Jens Axboe <axboe@kernel.dk> Cc: Matthew Wilcox <mawilcox@microsoft.com> Cc: Ross Zwisler <ross.zwisler@linux.intel.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 66a86cc commit 7a862fb

File tree

2 files changed

+0
-77
lines changed

2 files changed

+0
-77
lines changed

drivers/block/Kconfig

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,6 @@ config BLK_DEV_SX8
297297

298298
config BLK_DEV_RAM
299299
tristate "RAM block device support"
300-
select DAX if BLK_DEV_RAM_DAX
301300
---help---
302301
Saying Y here will allow you to use a portion of your RAM memory as
303302
a block device, so that you can make file systems on it, read and
@@ -333,17 +332,6 @@ config BLK_DEV_RAM_SIZE
333332
The default value is 4096 kilobytes. Only change this if you know
334333
what you are doing.
335334

336-
config BLK_DEV_RAM_DAX
337-
bool "Support Direct Access (DAX) to RAM block devices"
338-
depends on BLK_DEV_RAM && FS_DAX
339-
default n
340-
help
341-
Support filesystems using DAX to access RAM block devices. This
342-
avoids double-buffering data in the page cache before copying it
343-
to the block device. Answering Y will slightly enlarge the kernel,
344-
and will prevent RAM block device backing store memory from being
345-
allocated from highmem (only a problem for highmem systems).
346-
347335
config CDROM_PKTCDVD
348336
tristate "Packet writing on CD/DVD media (DEPRECATED)"
349337
depends on !UML

drivers/block/brd.c

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@
2020
#include <linux/radix-tree.h>
2121
#include <linux/fs.h>
2222
#include <linux/slab.h>
23-
#ifdef CONFIG_BLK_DEV_RAM_DAX
24-
#include <linux/pfn_t.h>
25-
#include <linux/dax.h>
26-
#include <linux/uio.h>
27-
#endif
2823

2924
#include <linux/uaccess.h>
3025

@@ -44,9 +39,6 @@ struct brd_device {
4439

4540
struct request_queue *brd_queue;
4641
struct gendisk *brd_disk;
47-
#ifdef CONFIG_BLK_DEV_RAM_DAX
48-
struct dax_device *dax_dev;
49-
#endif
5042
struct list_head brd_list;
5143

5244
/*
@@ -112,9 +104,6 @@ static struct page *brd_insert_page(struct brd_device *brd, sector_t sector)
112104
* restriction might be able to be lifted.
113105
*/
114106
gfp_flags = GFP_NOIO | __GFP_ZERO;
115-
#ifndef CONFIG_BLK_DEV_RAM_DAX
116-
gfp_flags |= __GFP_HIGHMEM;
117-
#endif
118107
page = alloc_page(gfp_flags);
119108
if (!page)
120109
return NULL;
@@ -334,43 +323,6 @@ static int brd_rw_page(struct block_device *bdev, sector_t sector,
334323
return err;
335324
}
336325

337-
#ifdef CONFIG_BLK_DEV_RAM_DAX
338-
static long __brd_direct_access(struct brd_device *brd, pgoff_t pgoff,
339-
long nr_pages, void **kaddr, pfn_t *pfn)
340-
{
341-
struct page *page;
342-
343-
if (!brd)
344-
return -ENODEV;
345-
page = brd_insert_page(brd, (sector_t)pgoff << PAGE_SECTORS_SHIFT);
346-
if (!page)
347-
return -ENOSPC;
348-
*kaddr = page_address(page);
349-
*pfn = page_to_pfn_t(page);
350-
351-
return 1;
352-
}
353-
354-
static long brd_dax_direct_access(struct dax_device *dax_dev,
355-
pgoff_t pgoff, long nr_pages, void **kaddr, pfn_t *pfn)
356-
{
357-
struct brd_device *brd = dax_get_private(dax_dev);
358-
359-
return __brd_direct_access(brd, pgoff, nr_pages, kaddr, pfn);
360-
}
361-
362-
static size_t brd_dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff,
363-
void *addr, size_t bytes, struct iov_iter *i)
364-
{
365-
return copy_from_iter(addr, bytes, i);
366-
}
367-
368-
static const struct dax_operations brd_dax_ops = {
369-
.direct_access = brd_dax_direct_access,
370-
.copy_from_iter = brd_dax_copy_from_iter,
371-
};
372-
#endif
373-
374326
static const struct block_device_operations brd_fops = {
375327
.owner = THIS_MODULE,
376328
.rw_page = brd_rw_page,
@@ -450,21 +402,8 @@ static struct brd_device *brd_alloc(int i)
450402
sprintf(disk->disk_name, "ram%d", i);
451403
set_capacity(disk, rd_size * 2);
452404

453-
#ifdef CONFIG_BLK_DEV_RAM_DAX
454-
queue_flag_set_unlocked(QUEUE_FLAG_DAX, brd->brd_queue);
455-
brd->dax_dev = alloc_dax(brd, disk->disk_name, &brd_dax_ops);
456-
if (!brd->dax_dev)
457-
goto out_free_inode;
458-
#endif
459-
460-
461405
return brd;
462406

463-
#ifdef CONFIG_BLK_DEV_RAM_DAX
464-
out_free_inode:
465-
kill_dax(brd->dax_dev);
466-
put_dax(brd->dax_dev);
467-
#endif
468407
out_free_queue:
469408
blk_cleanup_queue(brd->brd_queue);
470409
out_free_dev:
@@ -504,10 +443,6 @@ static struct brd_device *brd_init_one(int i, bool *new)
504443
static void brd_del_one(struct brd_device *brd)
505444
{
506445
list_del(&brd->brd_list);
507-
#ifdef CONFIG_BLK_DEV_RAM_DAX
508-
kill_dax(brd->dax_dev);
509-
put_dax(brd->dax_dev);
510-
#endif
511446
del_gendisk(brd->brd_disk);
512447
brd_free(brd);
513448
}

0 commit comments

Comments
 (0)