Skip to content

arshad512/LKBL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LKBL

Journaling

System crash can leave FS in inconsistent state. This can be repaired using FS checkers, however they are slow. Modern FS prefer journaling also known as “Write-ahead” logging. It is a technique when before actual writing of data, operation is logged. This helps in case of crash where only the journal log is replayed instead of whole disk scan. Journal can be a file within FS or different device. Journal normally contains a “Transaction” start, followed by what needs to be updated, finally it has an end marker called “transaction” end. These set of information have enough information to replay in case of crash. A Journaled FS, first writes the journaled log (also only called log) and once this is successful it “checkpoints” or updates the metadata with the latest information.

Every write can be divide into two operations. 1) First, write to metadata, 2) Second, The Data itself. (block write)

There are two types of journal setup:-

  1. Data journaling - Where both metadata and data are journaled. Downside, is that data is written twice.
  2. Metadata journaling (ordered) - Where only metadata is journaled. In this case data is first wirtten followed by Metadata.

Cases where FS can in inconsistent state

Metadata Failed and Data failed

  • FS is consistent. All failure.

Metadata failed but Data passed.

  • Here there will no updated inode pointing to data.
  • from FS point of view it is still consistent

Metadata passed but Data failed

  • Inode points to latest updated data. Which is not there but garbage
  • FS is in in-consistent state.

Write barrieres gurantees that the write before the issue of barrier would be executed first and would not be reorderd due to buffereing or cacheing. Journaling

Linux Kernel Block Layer

  1. blk_queue_flag_set
  2. blk_queue_flag_clear
  3. blk_queue_flag_test_and_set
  4. blk_rq_init
  5. errno_to_blk_status
  6. blk_status_to_errno
  7. blk_dump_rq_flags
  8. blk_sync_queue
  9. blk_set_pm_only
  10. blk_clear_pm_only
  11. blk_put_queue
  12. blk_set_queue_dying
  13. blk_cleanup_queue
  14. blk_alloc_queue
  15. blk_alloc_queue_node
  16. blk_get_queue
  17. blk_get_request
  18. blk_put_request
  19. blk_init_request_from_bio
  20. generic_make_request
  21. direct_make_request
  22. submit_bio
  23. blk_insert_cloned_request
  24. blk_rq_err_bytes
  25. blk_steal_bios
  26. blk_update_request
  27. rq_flush_dcache_pages
  28. blk_lld_busy
  29. blk_rq_unprep_clone
  30. blk_rq_prep_clone
  31. kblockd_schedule_work
  32. kblockd_schedule_work_on
  33. kblockd_mod_delayed_work_on
  34. blk_start_plug
  35. blk_check_plugged
  36. blk_finish_plug
  37. blkdev_issue_discard
  38. blkdev_issue_write_same
  39. blkdev_issue_zeroout
  40. fs_bio_set
  41. bio_uninit
  42. bio_init
  43. bio_reset
  44. bio_chain
  45. bio_alloc_bioset
  46. zero_fill_bio_iter
  47. bio_put
  48. bio_clone_fast
  49. bio_add_pc_page
  50. bio_add_page
  51. submit_bio_wait
  52. bio_advance
  53. bio_copy_data_iter
  54. bio_copy_data
  55. bio_list_copy_data
  56. bio_free_pages
  57. bio_map_kern
  58. generic_start_io_acct
  59. generic_end_io_acct
  60. bio_flush_dcache_pages
  61. bio_endio
  62. bio_split
  63. bio_trim
  64. bioset_exit
  65. bioset_init
  66. bioset_init_from_src
  67. bio_disassociate_blkg
  68. bio_associate_blkg_from_css
  69. bio_associate_blkg
  70. bio_clone_blkg_association

Releases

No releases published

Packages

No packages published