Now that all the producers and consumers of dax interfaces have been converted to using dax_operations on a dax_device, remove the block device direct_access enabling.
Unified · Split
| @@ -139,6 +139,10 @@ axon_ram_make_request(struct request_queue *queue, struct bio *bio) · 138 unmodified lines | ||
| 139 | 139 | return BLK_QC_T_NONE; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | +static const struct block_device_operations axon_ram_devops = { | |
| 143 | + .owner = THIS_MODULE, | |
| 144 | +}; | |
| 145 | + | |
| 142 | 146 | static long |
| 143 | 147 | __axon_ram_direct_access(struct axon_ram_bank *bank, pgoff_t pgoff, long nr_pages, |
| 144 | 148 | void **kaddr, pfn_t *pfn) |
| @@ -150,25 +154,6 @@ __axon_ram_direct_access(struct axon_ram_bank *bank, pgoff_t pgoff, long nr_page · 5 unmodified lines | ||
| 150 | 154 | return (bank->size - offset) / PAGE_SIZE; |
| 151 | 155 | } |
| 152 | 156 | |
| 153 | −/** | |
| 154 | − * axon_ram_direct_access - direct_access() method for block device | |
| 155 | − * @device, @sector, @data: see block_device_operations method | |
| 156 | − */ | |
| 157 | −static long | |
| 158 | −axon_ram_blk_direct_access(struct block_device *device, sector_t sector, | |
| 159 | − void **kaddr, pfn_t *pfn, long size) | |
| 160 | −{ | |
| 161 | − struct axon_ram_bank *bank = device->bd_disk->private_data; | |
| 162 | − | |
| 163 | − return __axon_ram_direct_access(bank, (sector * 512) / PAGE_SIZE, | |
| 164 | − size / PAGE_SIZE, kaddr, pfn) * PAGE_SIZE; | |
| 165 | −} | |
| 166 | − | |
| 167 | −static const struct block_device_operations axon_ram_devops = { | |
| 168 | − .owner = THIS_MODULE, | |
| 169 | − .direct_access = axon_ram_blk_direct_access | |
| 170 | −}; | |
| 171 | − | |
| 172 | 157 | static long |
| 173 | 158 | axon_ram_dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, long nr_pages, |
| 174 | 159 | void **kaddr, pfn_t *pfn) |
| @@ -395,18 +395,6 @@ static long __brd_direct_access(struct brd_device *brd, pgoff_t pgoff, · 394 unmodified lines | ||
| 395 | 395 | return 1; |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | −static long brd_blk_direct_access(struct block_device *bdev, sector_t sector, | |
| 399 | − void **kaddr, pfn_t *pfn, long size) | |
| 400 | −{ | |
| 401 | − struct brd_device *brd = bdev->bd_disk->private_data; | |
| 402 | − long nr_pages = __brd_direct_access(brd, PHYS_PFN(sector * 512), | |
| 403 | − PHYS_PFN(size), kaddr, pfn); | |
| 404 | − | |
| 405 | − if (nr_pages < 0) | |
| 406 | − return nr_pages; | |
| 407 | − return nr_pages * PAGE_SIZE; | |
| 408 | −} | |
| 409 | − | |
| 410 | 398 | static long brd_dax_direct_access(struct dax_device *dax_dev, |
| 411 | 399 | pgoff_t pgoff, long nr_pages, void **kaddr, pfn_t *pfn) |
| 412 | 400 | { |
| @@ -418,14 +406,11 @@ static long brd_dax_direct_access(struct dax_device *dax_dev, · 5 unmodified lines | ||
| 418 | 406 | static const struct dax_operations brd_dax_ops = { |
| 419 | 407 | .direct_access = brd_dax_direct_access, |
| 420 | 408 | }; |
| 421 | −#else | |
| 422 | −#define brd_blk_direct_access NULL | |
| 423 | 409 | #endif |
| 424 | 410 | |
| 425 | 411 | static const struct block_device_operations brd_fops = { |
| 426 | 412 | .owner = THIS_MODULE, |
| 427 | 413 | .rw_page = brd_rw_page, |
| 428 | − .direct_access = brd_blk_direct_access, | |
| 429 | 414 | }; |
| 430 | 415 | |
| 431 | 416 | /* |
| @@ -957,18 +957,6 @@ static long dm_dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, · 956 unmodified lines | ||
| 957 | 957 | return ret; |
| 958 | 958 | } |
| 959 | 959 | |
| 960 | −static long dm_blk_direct_access(struct block_device *bdev, sector_t sector, | |
| 961 | − void **kaddr, pfn_t *pfn, long size) | |
| 962 | −{ | |
| 963 | − struct mapped_device *md = bdev->bd_disk->private_data; | |
| 964 | − struct dax_device *dax_dev = md->dax_dev; | |
| 965 | − long nr_pages = size / PAGE_SIZE; | |
| 966 | − | |
| 967 | − nr_pages = dm_dax_direct_access(dax_dev, sector / PAGE_SECTORS, | |
| 968 | − nr_pages, kaddr, pfn); | |
| 969 | − return nr_pages < 0 ? nr_pages : nr_pages * PAGE_SIZE; | |
| 970 | −} | |
| 971 | − | |
| 972 | 960 | /* |
| 973 | 961 | * A target may call dm_accept_partial_bio only from the map routine. It is |
| 974 | 962 | * allowed for all bio types except REQ_PREFLUSH. |
| @@ -2823,7 +2811,6 @@ static const struct block_device_operations dm_blk_dops = { · 1848 unmodified lines | ||
| 2823 | 2811 | .open = dm_blk_open, |
| 2824 | 2812 | .release = dm_blk_close, |
| 2825 | 2813 | .ioctl = dm_blk_ioctl, |
| 2826 | − .direct_access = dm_blk_direct_access, | |
| 2827 | 2814 | .getgeo = dm_blk_getgeo, |
| 2828 | 2815 | .pr_ops = &dm_pr_ops, |
| 2829 | 2816 | .owner = THIS_MODULE |
| @@ -220,19 +220,9 @@ __weak long __pmem_direct_access(struct pmem_device *pmem, pgoff_t pgoff, · 219 unmodified lines | ||
| 220 | 220 | return PHYS_PFN(pmem->size - pmem->pfn_pad - offset); |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | −static long pmem_blk_direct_access(struct block_device *bdev, sector_t sector, | |
| 224 | − void **kaddr, pfn_t *pfn, long size) | |
| 225 | −{ | |
| 226 | − struct pmem_device *pmem = bdev->bd_queue->queuedata; | |
| 227 | − | |
| 228 | − return __pmem_direct_access(pmem, PHYS_PFN(sector * 512), | |
| 229 | − PHYS_PFN(size), kaddr, pfn); | |
| 230 | −} | |
| 231 | − | |
| 232 | 223 | static const struct block_device_operations pmem_fops = { |
| 233 | 224 | .owner = THIS_MODULE, |
| 234 | 225 | .rw_page = pmem_rw_page, |
| 235 | − .direct_access = pmem_blk_direct_access, | |
| 236 | 226 | .revalidate_disk = nvdimm_revalidate_disk, |
| 237 | 227 | }; |
| 238 | 228 | |
| @@ -31,8 +31,6 @@ static int dcssblk_open(struct block_device *bdev, fmode_t mode); · 30 unmodified lines | ||
| 31 | 31 | static void dcssblk_release(struct gendisk *disk, fmode_t mode); |
| 32 | 32 | static blk_qc_t dcssblk_make_request(struct request_queue *q, |
| 33 | 33 | struct bio *bio); |
| 34 | −static long dcssblk_blk_direct_access(struct block_device *bdev, sector_t secnum, | |
| 35 | − void **kaddr, pfn_t *pfn, long size); | |
| 36 | 34 | static long dcssblk_dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, |
| 37 | 35 | long nr_pages, void **kaddr, pfn_t *pfn); |
| 38 | 36 | |
| @@ -43,7 +41,6 @@ static const struct block_device_operations dcssblk_devops = { · 4 unmodified lines | ||
| 43 | 41 | .owner = THIS_MODULE, |
| 44 | 42 | .open = dcssblk_open, |
| 45 | 43 | .release = dcssblk_release, |
| 46 | − .direct_access = dcssblk_blk_direct_access, | |
| 47 | 44 | }; |
| 48 | 45 | |
| 49 | 46 | static const struct dax_operations dcssblk_dax_ops = { |
| @@ -915,19 +912,6 @@ __dcssblk_direct_access(struct dcssblk_dev_info *dev_info, pgoff_t pgoff, · 865 unmodified lines | ||
| 915 | 912 | return (dev_sz - offset) / PAGE_SIZE; |
| 916 | 913 | } |
| 917 | 914 | |
| 918 | −static long | |
| 919 | −dcssblk_blk_direct_access(struct block_device *bdev, sector_t secnum, | |
| 920 | − void **kaddr, pfn_t *pfn, long size) | |
| 921 | −{ | |
| 922 | − struct dcssblk_dev_info *dev_info; | |
| 923 | − | |
| 924 | − dev_info = bdev->bd_disk->private_data; | |
| 925 | − if (!dev_info) | |
| 926 | − return -ENODEV; | |
| 927 | − return __dcssblk_direct_access(dev_info, PHYS_PFN(secnum * 512), | |
| 928 | − PHYS_PFN(size), kaddr, pfn) * PAGE_SIZE; | |
| 929 | −} | |
| 930 | − | |
| 931 | 915 | static long |
| 932 | 916 | dcssblk_dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, |
| 933 | 917 | long nr_pages, void **kaddr, pfn_t *pfn) |
| @@ -718,51 +718,6 @@ int bdev_write_page(struct block_device *bdev, sector_t sector, · 717 unmodified lines | ||
| 718 | 718 | } |
| 719 | 719 | EXPORT_SYMBOL_GPL(bdev_write_page); |
| 720 | 720 | |
| 721 | −/** | |
| 722 | − * bdev_direct_access() - Get the address for directly-accessibly memory | |
| 723 | − * @bdev: The device containing the memory | |
| 724 | − * @dax: control and output parameters for ->direct_access | |
| 725 | − * | |
| 726 | − * If a block device is made up of directly addressable memory, this function | |
| 727 | − * will tell the caller the PFN and the address of the memory. The address | |
| 728 | − * may be directly dereferenced within the kernel without the need to call | |
| 729 | − * ioremap(), kmap() or similar. The PFN is suitable for inserting into | |
| 730 | − * page tables. | |
| 731 | − * | |
| 732 | − * Return: negative errno if an error occurs, otherwise the number of bytes | |
| 733 | − * accessible at this address. | |
| 734 | − */ | |
| 735 | −long bdev_direct_access(struct block_device *bdev, struct blk_dax_ctl *dax) | |
| 736 | −{ | |
| 737 | − sector_t sector = dax->sector; | |
| 738 | − long avail, size = dax->size; | |
| 739 | − const struct block_device_operations *ops = bdev->bd_disk->fops; | |
| 740 | − | |
| 741 | − /* | |
| 742 | − * The device driver is allowed to sleep, in order to make the | |
| 743 | − * memory directly accessible. | |
| 744 | − */ | |
| 745 | − might_sleep(); | |
| 746 | − | |
| 747 | − if (size < 0) | |
| 748 | − return size; | |
| 749 | − if (!blk_queue_dax(bdev_get_queue(bdev)) || !ops->direct_access) | |
| 750 | − return -EOPNOTSUPP; | |
| 751 | − if ((sector + DIV_ROUND_UP(size, 512)) > | |
| 752 | − part_nr_sects_read(bdev->bd_part)) | |
| 753 | − return -ERANGE; | |
| 754 | − sector += get_start_sect(bdev); | |
| 755 | − if (sector % (PAGE_SIZE / 512)) | |
| 756 | − return -EINVAL; | |
| 757 | − avail = ops->direct_access(bdev, sector, &dax->addr, &dax->pfn, size); | |
| 758 | − if (!avail) | |
| 759 | − return -ERANGE; | |
| 760 | − if (avail > 0 && avail & ~PAGE_MASK) | |
| 761 | − return -ENXIO; | |
| 762 | − return min(avail, size); | |
| 763 | −} | |
| 764 | −EXPORT_SYMBOL_GPL(bdev_direct_access); | |
| 765 | − | |
| 766 | 721 | int bdev_dax_pgoff(struct block_device *bdev, sector_t sector, size_t size, |
| 767 | 722 | pgoff_t *pgoff) |
| 768 | 723 | { |
| @@ -1916,28 +1916,12 @@ static inline bool integrity_req_gap_front_merge(struct request *req, · 1915 unmodified lines | ||
| 1916 | 1916 | |
| 1917 | 1917 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ |
| 1918 | 1918 | |
| 1919 | −/** | |
| 1920 | − * struct blk_dax_ctl - control and output parameters for ->direct_access | |
| 1921 | − * @sector: (input) offset relative to a block_device | |
| 1922 | − * @addr: (output) kernel virtual address for @sector populated by driver | |
| 1923 | − * @pfn: (output) page frame number for @addr populated by driver | |
| 1924 | − * @size: (input) number of bytes requested | |
| 1925 | − */ | |
| 1926 | −struct blk_dax_ctl { | |
| 1927 | − sector_t sector; | |
| 1928 | − void *addr; | |
| 1929 | − long size; | |
| 1930 | − pfn_t pfn; | |
| 1931 | −}; | |
| 1932 | − | |
| 1933 | 1919 | struct block_device_operations { |
| 1934 | 1920 | int (*open) (struct block_device *, fmode_t); |
| 1935 | 1921 | void (*release) (struct gendisk *, fmode_t); |
| 1936 | 1922 | int (*rw_page)(struct block_device *, sector_t, struct page *, bool); |
| 1937 | 1923 | int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); |
| 1938 | 1924 | int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); |
| 1939 | − long (*direct_access)(struct block_device *, sector_t, void **, pfn_t *, | |
| 1940 | − long); | |
| 1941 | 1925 | unsigned int (*check_events) (struct gendisk *disk, |
| 1942 | 1926 | unsigned int clearing); |
| 1943 | 1927 | /* ->media_changed() is DEPRECATED, use ->check_events() instead */ |
| @@ -1956,7 +1940,6 @@ extern int __blkdev_driver_ioctl(struct block_device *, fmode_t, unsigned int, · 12 unmodified lines | ||
| 1956 | 1940 | extern int bdev_read_page(struct block_device *, sector_t, struct page *); |
| 1957 | 1941 | extern int bdev_write_page(struct block_device *, sector_t, struct page *, |
| 1958 | 1942 | struct writeback_control *); |
| 1959 | −extern long bdev_direct_access(struct block_device *, struct blk_dax_ctl *); | |
| 1960 | 1943 | extern int bdev_dax_supported(struct super_block *, int); |
| 1961 | 1944 | int bdev_dax_pgoff(struct block_device *, sector_t, size_t, pgoff_t *pgoff); |
| 1962 | 1945 | #else /* CONFIG_BLOCK */ |