Merge branch 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull libnvdimm fixes from Dan Williams: - a boot regression (since v4.2) fix for some ARM configurations from Tyler - regression (since v4.1) fixes for mkfs.xfs on a DAX enabled device from Jeff. These are tagged for -stable. - a pair of locking fixes from Axel that are hidden from lockdep since they involve device_lock(). The "btt" one is tagged for -stable, the other only applies to the new "pfn" mechanism in v4.3. - a fix for the pmem ->rw_page() path to use wmb_pmem() from Ross. * 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: mm: fix type cast in __pfn_to_phys() pmem: add proper fencing to pmem_rw_page() libnvdimm: pfn_devs: Fix locking in namespace_store libnvdimm: btt_devs: Fix locking in namespace_store blockdev: don't set S_DAX for misaligned partitions dax: fix O_DIRECT I/O to the last block of a blockdev
This commit is contained in:
commit
2673ee565f
|
@ -128,13 +128,13 @@ static ssize_t namespace_store(struct device *dev,
|
||||||
struct nd_btt *nd_btt = to_nd_btt(dev);
|
struct nd_btt *nd_btt = to_nd_btt(dev);
|
||||||
ssize_t rc;
|
ssize_t rc;
|
||||||
|
|
||||||
nvdimm_bus_lock(dev);
|
|
||||||
device_lock(dev);
|
device_lock(dev);
|
||||||
|
nvdimm_bus_lock(dev);
|
||||||
rc = nd_namespace_store(dev, &nd_btt->ndns, buf, len);
|
rc = nd_namespace_store(dev, &nd_btt->ndns, buf, len);
|
||||||
dev_dbg(dev, "%s: result: %zd wrote: %s%s", __func__,
|
dev_dbg(dev, "%s: result: %zd wrote: %s%s", __func__,
|
||||||
rc, buf, buf[len - 1] == '\n' ? "" : "\n");
|
rc, buf, buf[len - 1] == '\n' ? "" : "\n");
|
||||||
device_unlock(dev);
|
|
||||||
nvdimm_bus_unlock(dev);
|
nvdimm_bus_unlock(dev);
|
||||||
|
device_unlock(dev);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,13 +148,13 @@ static ssize_t namespace_store(struct device *dev,
|
||||||
struct nd_pfn *nd_pfn = to_nd_pfn(dev);
|
struct nd_pfn *nd_pfn = to_nd_pfn(dev);
|
||||||
ssize_t rc;
|
ssize_t rc;
|
||||||
|
|
||||||
nvdimm_bus_lock(dev);
|
|
||||||
device_lock(dev);
|
device_lock(dev);
|
||||||
|
nvdimm_bus_lock(dev);
|
||||||
rc = nd_namespace_store(dev, &nd_pfn->ndns, buf, len);
|
rc = nd_namespace_store(dev, &nd_pfn->ndns, buf, len);
|
||||||
dev_dbg(dev, "%s: result: %zd wrote: %s%s", __func__,
|
dev_dbg(dev, "%s: result: %zd wrote: %s%s", __func__,
|
||||||
rc, buf, buf[len - 1] == '\n' ? "" : "\n");
|
rc, buf, buf[len - 1] == '\n' ? "" : "\n");
|
||||||
device_unlock(dev);
|
|
||||||
nvdimm_bus_unlock(dev);
|
nvdimm_bus_unlock(dev);
|
||||||
|
device_unlock(dev);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,8 @@ static int pmem_rw_page(struct block_device *bdev, sector_t sector,
|
||||||
struct pmem_device *pmem = bdev->bd_disk->private_data;
|
struct pmem_device *pmem = bdev->bd_disk->private_data;
|
||||||
|
|
||||||
pmem_do_bvec(pmem, page, PAGE_CACHE_SIZE, 0, rw, sector);
|
pmem_do_bvec(pmem, page, PAGE_CACHE_SIZE, 0, rw, sector);
|
||||||
|
if (rw & WRITE)
|
||||||
|
wmb_pmem();
|
||||||
page_endio(page, rw & WRITE, 0);
|
page_endio(page, rw & WRITE, 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1242,6 +1242,13 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
|
||||||
goto out_clear;
|
goto out_clear;
|
||||||
}
|
}
|
||||||
bd_set_size(bdev, (loff_t)bdev->bd_part->nr_sects << 9);
|
bd_set_size(bdev, (loff_t)bdev->bd_part->nr_sects << 9);
|
||||||
|
/*
|
||||||
|
* If the partition is not aligned on a page
|
||||||
|
* boundary, we can't do dax I/O to it.
|
||||||
|
*/
|
||||||
|
if ((bdev->bd_part->start_sect % (PAGE_SIZE / 512)) ||
|
||||||
|
(bdev->bd_part->nr_sects % (PAGE_SIZE / 512)))
|
||||||
|
bdev->bd_inode->i_flags &= ~S_DAX;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (bdev->bd_contains == bdev) {
|
if (bdev->bd_contains == bdev) {
|
||||||
|
|
3
fs/dax.c
3
fs/dax.c
|
@ -119,7 +119,8 @@ static ssize_t dax_io(struct inode *inode, struct iov_iter *iter,
|
||||||
size_t len;
|
size_t len;
|
||||||
if (pos == max) {
|
if (pos == max) {
|
||||||
unsigned blkbits = inode->i_blkbits;
|
unsigned blkbits = inode->i_blkbits;
|
||||||
sector_t block = pos >> blkbits;
|
long page = pos >> PAGE_SHIFT;
|
||||||
|
sector_t block = page << (PAGE_SHIFT - blkbits);
|
||||||
unsigned first = pos - (block << blkbits);
|
unsigned first = pos - (block << blkbits);
|
||||||
long size;
|
long size;
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
* Convert a physical address to a Page Frame Number and back
|
* Convert a physical address to a Page Frame Number and back
|
||||||
*/
|
*/
|
||||||
#define __phys_to_pfn(paddr) ((unsigned long)((paddr) >> PAGE_SHIFT))
|
#define __phys_to_pfn(paddr) ((unsigned long)((paddr) >> PAGE_SHIFT))
|
||||||
#define __pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT)
|
#define __pfn_to_phys(pfn) PFN_PHYS(pfn)
|
||||||
|
|
||||||
#define page_to_pfn __page_to_pfn
|
#define page_to_pfn __page_to_pfn
|
||||||
#define pfn_to_page __pfn_to_page
|
#define pfn_to_page __pfn_to_page
|
||||||
|
|
Loading…
Reference in New Issue