Skip to content

Commit

Permalink
blockdev: don't set S_DAX for misaligned partitions
Browse files Browse the repository at this point in the history
The dax code doesn't currently support misaligned partitions,
so disable O_DIRECT via dax until such time as that support
materializes.

Cc: <[email protected]>
Suggested-by: Boaz Harrosh <[email protected]>
Signed-off-by: Jeff Moyer <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
  • Loading branch information
JeffMoyer authored and djbw committed Sep 16, 2015
1 parent e94f5a2 commit f0b2e56
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fs/block_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1242,6 +1242,13 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
goto out_clear;
}
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 {
if (bdev->bd_contains == bdev) {
Expand Down

0 comments on commit f0b2e56

Please sign in to comment.