-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reimplement the read and the write operations
This commit implements the 'simplefs_write' and 'simplefs_read' functions for the simplefs filesystem. These functions handle data writing and reading operations directly from the disk, bypassing the page cache. To achieve this, we used the 'sb_bread' and 'brelse' functions provided by the Linux kernel to read data directly from the disk. For writing data, we used the 'mark_buffer_dirty' and 'sync_dirty_buffer' functions to ensure that data is correctly written to the disk. Removing 'generic_file_read_iter' and 'generic_file_write_iter'. Through the following experiment, we can observe that once we implement 'simplefs_read', 'generic_file_read_iter' is no longer called, and the same applies to simplefs_write. Experiment: First, wrap 'generic_file_read_iter' with 'test_generic_file_read_iter' and then set up the following: $ echo function > current_tracer $ echo test_generic_file_read_iter > set_ftrace_filter $ echo simplefs_read > set_ftrace_filter Run the fio command: $ fio --name=readtest --size=1M --filename=./testfile --bs=4k \ --rw=read --iodepth=4 From the results, we can see that 'test_generic_file_read_iter' is no longer used. root@vm:/sys/kernel/debug/tracing# cat trace tracer: function entries-in-buffer/entries-written: 256/256 #P:4 _-----=> irqs-off/BH-disabled / _----=> need-resched | / _---=> hardirq/softirq || / _--=> preempt-depth ||| / _-=> migrate-disable |||| / delay TASK-PID CPU# ||||| TIMESTAMP FUNCTION | | | ||||| | | fio-44553 [001] ...1. 83186.031300: simplefs_read <-vfs_read fio-44553 [001] ...1. 83186.031325: simplefs_read <-vfs_read fio-44553 [001] ...1. 83186.031328: simplefs_read <-vfs_read fio-44553 [001] ...1. 83186.031332: simplefs_read <-vfs_read ... fio-44553 [001] ...1. 83186.031880: simplefs_read <-vfs_read Close #57
- Loading branch information
1 parent
92f3287
commit 55fd46a
Showing
2 changed files
with
170 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters