The functions are not invoked directly by the VFS code but indirectly by the operations contained in the standard file operations for block devices defblkfops

The remaining elements of block_device_operations list the options available only to block devices.

□ media_changed checks whether the storage medium has been changed as can happen with devices such as floppy disks and ZIP drives (hard disks do not usually support this function because they cannot normally be exchanged ... ). The routine is provided for internal use in the kernel to prevent inconsistencies owing to careless user interaction. Data loss is inevitable if a floppy disk is removed from the drive without first having been unmounted and if the data in the cache have not been synchronized with the contents on the disk in the meantime. The situation is even worse if a user removes a floppy disk whose changes have not yet been written back and inserts a new floppy with different contents. When writeback finally takes place, the contents of the new floppy are destroyed or at least severely compromised — this should be prevented at all costs because it compounds the fact that the data on the first floppy have already been lost. The kernel can, indeed, prevent such loss by invoking check_media_change at the appropriate points in the code.

□ As its name suggests, revalidate_disk is called to revalidate the device. Currently, this is only necessary when an old medium is removed and replaced with a new medium without first performing a correct unmount followed by a new mount.

The owner field holds a pointer to a module structure in memory if the driver is implemented as a module. Otherwise, it contains a null pointer.

Continue reading here: Request Queues

Was this article helpful?

0 0