2 ms·
Today, though, that filesystem abstraction is block-aligned. So you could delete blocks from the beginning or middle of a file easily, but you couldn't delete b
by JoshTriplett 7y ago
Today, though, that filesystem abstraction is block-aligned. So you could delete blocks from the beginning or middle of a file easily, but you couldn't delete bytes from the beginning or middle.
- derefr 7y agoRight—the difference is that, with a file object, the extents are all assumed to be full to capacity except for the very last one, with the information on the virtual size within the last extent being held in the file's inode. Whereas, with these vector-of-buffers objects, either each extent would need to reserve two bytes at the beginning to represent the virtual size of that extent, or the vector would be a vector of disk slices at byte granularity, rather than a vector of plain disk offsets at sector granularity. I can see the arguments for both. The former is extremely efficient, and would probably be the go-to for databases that want to be performant without needing to dedicate a raw block device to them. The latter approach, though, you can implement entirely "on top of" the filesystem (in the same way that the ext3 journal, or APFS containers, are implemented "on top of" their filesystems.) You could have a regular file representing the storage reservation (in full extents) for the vector-object; and then the vector object could be a tree (or something else efficient to rewrite) of byte-granular slices of offsets into that backing storage-file, with logic to ensure that such a reserved slice never straddles two extents, and a cache in the entry for a pointer to the actual extent. These would be perfect for, say, generating archive files. In fact, since these are such different use-cases, there's no reason to not just give users both.
- JoshTriplett 7y agoFor that matter, byte-oriented persistent memory would allow something byte-oriented and not block-oriented.
- derefr 7y agoBy itself, no. If the persistent memory is considered physical memory and there's virtual memory on top of it—but the part of the virtual-memory map that represents the persistent memory is itself persisted in the persistent memory—then you'd have something quite similar. It'd be similar to—but faster than—what you'd get if you could both talk to, and past, the flash controller for a regular SSD, allowing you to both see an LBA block device, and see the physical extents + allocation map managed by the flash controller underlying the block device. (But you'd need to be able to write to the allocation map yourself, without making the flash controller fall over, which, well, good luck.)