super.c (60696eb26a37ab0199f7833ddbc1b75138c36d16) | super.c (cd913c76f489def1a388e3a5b10df94948ede3f5) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright(c) 2017 Intel Corporation. All rights reserved. 4 */ 5#include <linux/pagemap.h> 6#include <linux/module.h> 7#include <linux/mount.h> 8#include <linux/pseudo_fs.h> --- 55 unchanged lines hidden (view full) --- 64{ 65 xa_erase(&dax_hosts, (unsigned long)disk); 66} 67EXPORT_SYMBOL_GPL(dax_remove_host); 68 69/** 70 * fs_dax_get_by_bdev() - temporary lookup mechanism for filesystem-dax 71 * @bdev: block device to find a dax_device for | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright(c) 2017 Intel Corporation. All rights reserved. 4 */ 5#include <linux/pagemap.h> 6#include <linux/module.h> 7#include <linux/mount.h> 8#include <linux/pseudo_fs.h> --- 55 unchanged lines hidden (view full) --- 64{ 65 xa_erase(&dax_hosts, (unsigned long)disk); 66} 67EXPORT_SYMBOL_GPL(dax_remove_host); 68 69/** 70 * fs_dax_get_by_bdev() - temporary lookup mechanism for filesystem-dax 71 * @bdev: block device to find a dax_device for |
72 * @start_off: returns the byte offset into the dax_device that @bdev starts |
|
72 */ | 73 */ |
73struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev) | 74struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev, u64 *start_off) |
74{ 75 struct dax_device *dax_dev; | 75{ 76 struct dax_device *dax_dev; |
77 u64 part_size; |
|
76 int id; 77 78 if (!blk_queue_dax(bdev->bd_disk->queue)) 79 return NULL; 80 | 78 int id; 79 80 if (!blk_queue_dax(bdev->bd_disk->queue)) 81 return NULL; 82 |
81 if ((get_start_sect(bdev) * SECTOR_SIZE) % PAGE_SIZE || 82 (bdev_nr_sectors(bdev) * SECTOR_SIZE) % PAGE_SIZE) { | 83 *start_off = get_start_sect(bdev) * SECTOR_SIZE; 84 part_size = bdev_nr_sectors(bdev) * SECTOR_SIZE; 85 if (*start_off % PAGE_SIZE || part_size % PAGE_SIZE) { |
83 pr_info("%pg: error: unaligned partition for dax\n", bdev); 84 return NULL; 85 } 86 87 id = dax_read_lock(); 88 dax_dev = xa_load(&dax_hosts, (unsigned long)bdev->bd_disk); 89 if (!dax_dev || !dax_alive(dax_dev) || !igrab(&dax_dev->inode)) 90 dax_dev = NULL; --- 400 unchanged lines hidden --- | 86 pr_info("%pg: error: unaligned partition for dax\n", bdev); 87 return NULL; 88 } 89 90 id = dax_read_lock(); 91 dax_dev = xa_load(&dax_hosts, (unsigned long)bdev->bd_disk); 92 if (!dax_dev || !dax_alive(dax_dev) || !igrab(&dax_dev->inode)) 93 dax_dev = NULL; --- 400 unchanged lines hidden --- |