static struct address_space_operations shmem_aops = { .writepage = shmem_writepage,

.set_page_dirty = _set_page_dirty_no_writeback,

.migratepage = migrate_page,

All that need be implemented is the marking of the page as dirty, page writeback, and page migration. The other operations are not used to provide shared memory.5 With which backing store does the kernel operate in this case? Memory from the shared-memory filesystem is totally independent of a specific block device because all files of the filesystem are generated dynamically (e.g., by copying the contents of a file from another filesystem, or by writing calculated data into a new file) and do not reside on any original block device.

Memory shortage can, of course, also apply to pages that belong to this filesystem so that it is then necessary to write the pages back to the backing store. Because there is no backing store in the real sense, the swap area is used in its stead. Whereas normal files are written back to their filesystem on the hard disk (or on any other block device) in order to free the used page frame, files of the shared-memory filesystem must be stored in the swap area.

Since access to block devices need not always be made by way of filesystems but may also apply to raw devices, there are address space operations to support the direct manipulation of the contents of block devices (this kind of access is required, e.g., when creating filesystems from within userspace):

Continue reading here: Fsblockdevc

Was this article helpful?

0 0