On Thu, Nov 04, 2021 at 11:09:19PM -0400, Theodore Ts'o wrote: > On Thu, Nov 04, 2021 at 12:04:43PM -0700, Darrick J. Wong wrote: > > > Note that I've avoided implementing read/write fops for dax devices > > > partly out of concern for not wanting to figure out shared-mmap vs > > > write coherence issues, but also because of a bet with Dave Hansen > > > that device-dax not grow features like what happened to hugetlbfs. So > > > it would seem mkfs would need to switch to mmap I/O, or bite the > > > bullet and implement read/write fops in the driver. > > > > That ... would require a fair amount of userspace changes, though at > > least e2fsprogs has pluggable io drivers, which would make mmapping a > > character device not too awful. > > > > xfsprogs would be another story -- porting the buffer cache mignt not be > > too bad, but mkfs and repair seem to issue pread/pwrite calls directly. > > Note that xfsprogs explicitly screens out chardevs. > > It's not just e2fsprogs and xfsprogs. There's also udev, blkid, > potententially systemd unit generators to kick off fsck runs, etc. > There are probably any number of user scripts which assume that file > systems are mounted on block devices --- for example, by looking at > the output of lsblk, etc. > > Also note that block devices have O_EXCL support to provide locking > against attempts to run mkfs on a mounted file system. If you move > dax file systems to be mounted on a character mode device, that would > have to be replicated as well, etc. So I suspect that a large number > of subtle things would break, and I'd strongly recommend against going > down that path. Agreed. There were reasons we decided to present pmem as "block device with extra functionality" rather than try to cram all the block layer functionality (eg submitting BIOs for filesystem metadata) into a character device. Some of those assumptions might be worth re-examining, but I haven't seen anything that makes me say "this is obviously better than what we did at the time".