Skip to content

LNX-165: Improve lnx fs cache #220

LNX-165: Improve lnx fs cache

LNX-165: Improve lnx fs cache #220

Triggered via pull request February 17, 2025 23:55
Status Failure
Total duration 1m 15s
Artifacts

lint.yml

on: pull_request
Fit to window
Zoom out
Zoom in

Annotations

2 errors and 45 warnings
`todo` should not be present in production code: lnx-fs/src/page_cache/mod.rs#L100
error: `todo` should not be present in production code --> lnx-fs/src/page_cache/mod.rs:100:9 | 100 | todo!() | ^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#todo
clippy
Clippy had exited with the 101 exit code
fmt
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
fmt
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
fmt
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
fmt
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
very complex type used. Consider factoring parts into `type` definitions: lnx-fs/src/page_cache/gc.rs#L73
warning: very complex type used. Consider factoring parts into `type` definitions --> lnx-fs/src/page_cache/gc.rs:73:15 | 73 | triggers: BTreeMap<u64, SmallVec<[(Range<u64>, TriggerCallback); 1]>>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity = note: `#[warn(clippy::type_complexity)]` on by default
deref which would be done by auto-deref: lnx-fs/src/metastore/mod.rs#L125
warning: deref which would be done by auto-deref --> lnx-fs/src/metastore/mod.rs:125:34 | 125 | .filter(|entry| pred(&*entry)) | ^^^^^^^ help: try: `entry` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref = note: `#[warn(clippy::explicit_auto_deref)]` on by default
this expression creates a reference which is immediately dereferenced by the compiler: lnx-fs/src/metastore/mod.rs#L125
warning: this expression creates a reference which is immediately dereferenced by the compiler --> lnx-fs/src/metastore/mod.rs:125:34 | 125 | .filter(|entry| pred(&*entry)) | ^^^^^^^ help: change this to: `*entry` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow = note: `#[warn(clippy::needless_borrow)]` on by default
deref on an immutable reference: lnx-fs/src/metastore/mod.rs#L125
warning: deref on an immutable reference --> lnx-fs/src/metastore/mod.rs:125:34 | 125 | .filter(|entry| pred(&*entry)) | ^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#borrow_deref_ref = note: `#[warn(clippy::borrow_deref_ref)]` on by default help: if you would like to reborrow, try removing `&*` | 125 - .filter(|entry| pred(&*entry)) 125 + .filter(|entry| pred(entry)) | help: if you would like to deref, try using `&**` | 125 - .filter(|entry| pred(&*entry)) 125 + .filter(|entry| pred(&**entry)) |
the following explicit lifetimes could be elided: 'a: lnx-fs/src/metastore/mutate.rs#L14
warning: the following explicit lifetimes could be elided: 'a --> lnx-fs/src/metastore/mutate.rs:14:6 | 14 | impl<'a> BulkMetastoreModifyOperation<'a> { | ^^ ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes = note: `#[warn(clippy::needless_lifetimes)]` on by default help: elide the lifetimes | 14 - impl<'a> BulkMetastoreModifyOperation<'a> { 14 + impl BulkMetastoreModifyOperation<'_> { |
associated items `ALLOCATED`, `TO_BE_FREED`, `is_allocated`, and `is_to_be_freed` are never used: lnx-fs/src/page_cache/page.rs#L159
warning: associated items `ALLOCATED`, `TO_BE_FREED`, `is_allocated`, and `is_to_be_freed` are never used --> lnx-fs/src/page_cache/page.rs:159:11 | 158 | impl PageFlags { | -------------- associated items in this implementation 159 | const ALLOCATED: u8 = 1 << 0; | ^^^^^^^^^ 160 | const TO_BE_FREED: u8 = 1 << 1; | ^^^^^^^^^^^ ... 163 | pub(super) fn is_allocated(&self) -> bool { | ^^^^^^^^^^^^ ... 168 | pub(super) fn is_to_be_freed(&self) -> bool { | ^^^^^^^^^^^^^^
struct `PageFlags` is never constructed: lnx-fs/src/page_cache/page.rs#L156
warning: struct `PageFlags` is never constructed --> lnx-fs/src/page_cache/page.rs:156:19 | 156 | pub(super) struct PageFlags(u8); | ^^^^^^^^^
methods `load`, `set_free`, `set_allocated`, and `set_to_be_freed` are never used: lnx-fs/src/page_cache/page.rs#L138
warning: methods `load`, `set_free`, `set_allocated`, and `set_to_be_freed` are never used --> lnx-fs/src/page_cache/page.rs:138:19 | 136 | impl AtomicPageFlags { | -------------------- methods in this implementation 137 | /// Performs a relaxed load of the page flags. 138 | pub(super) fn load(&self) -> PageFlags { | ^^^^ ... 142 | fn set_free(&self) { | ^^^^^^^^ ... 146 | fn set_allocated(&self) { | ^^^^^^^^^^^^^ ... 150 | fn set_to_be_freed(&self) { | ^^^^^^^^^^^^^^^
field `0` is never read: lnx-fs/src/page_cache/page.rs#L134
warning: field `0` is never read --> lnx-fs/src/page_cache/page.rs:134:35 | 134 | pub(super) struct AtomicPageFlags(AtomicU8); | --------------- ^^^^^^^^ | | | field in this struct | = help: consider removing this field = note: `AtomicPageFlags` has a derived impl for the trait `Default`, but this is intentionally ignored during dead code analysis
associated items `new`, `len`, `at`, and `pointer_to_index` are never used: lnx-fs/src/page_cache/page.rs#L96
warning: associated items `new`, `len`, `at`, and `pointer_to_index` are never used --> lnx-fs/src/page_cache/page.rs:96:19 | 94 | impl PageStateTable { | ------------------- associated items in this implementation 95 | /// Creates a new page state table with the given num pages. 96 | pub(super) fn new(num_pages: usize) -> Self { | ^^^ ... 109 | pub(super) fn len(&self) -> usize { | ^^^ ... 115 | pub(super) fn at(&self, idx: PageId) -> &PageState { | ^^ ... 123 | pub(super) fn pointer_to_index(&self, page: *const PageState) -> PageId { | ^^^^^^^^^^^^^^^^
field `table` is never read: lnx-fs/src/page_cache/page.rs#L91
warning: field `table` is never read --> lnx-fs/src/page_cache/page.rs:91:5 | 90 | pub(super) struct PageStateTable { | -------------- field in this struct 91 | table: Box<[PageState]>, | ^^^^^
multiple associated items are never used: lnx-fs/src/page_cache/page.rs#L20
warning: multiple associated items are never used --> lnx-fs/src/page_cache/page.rs:20:8 | 19 | impl PageState { | -------------- associated items in this implementation 20 | fn empty() -> Self { | ^^^^^ ... 29 | pub(super) fn is_locked(&self) -> bool { | ^^^^^^^^^ ... 35 | pub(super) fn flags(&self) -> PageFlags { | ^^^^^ ... 44 | pub(super) unsafe fn set_free_unchecked(&self) { | ^^^^^^^^^^^^^^^^^^ ... 53 | pub(super) unsafe fn set_allocated_unchecked(&self) { | ^^^^^^^^^^^^^^^^^^^^^^^ ... 62 | pub(super) unsafe fn set_to_be_freed_unchecked(&self) { | ^^^^^^^^^^^^^^^^^^^^^^^^^ ... 74 | pub(super) unsafe fn try_acquire_write_guard( | ^^^^^^^^^^^^^^^^^^^^^^^
fields `lock` and `flags` are never read: lnx-fs/src/page_cache/page.rs#L14
warning: fields `lock` and `flags` are never read --> lnx-fs/src/page_cache/page.rs:14:5 | 12 | pub(super) struct PageState { | --------- fields in this struct 13 | /// The write lock guard for synchronizing writes. 14 | lock: PageMutex, | ^^^^ 15 | /// The flags set for the given page. 16 | flags: AtomicPageFlags, | ^^^^^
type alias `PageWriteLockGuard` is never used: lnx-fs/src/page_cache/page.rs#L6
warning: type alias `PageWriteLockGuard` is never used --> lnx-fs/src/page_cache/page.rs:6:17 | 6 | pub(super) type PageWriteLockGuard<'a> = parking_lot::MutexGuard<'a, ()>; | ^^^^^^^^^^^^^^^^^^
variants `RegisterGeneration` and `RegisterTrigger` are never constructed: lnx-fs/src/page_cache/gc.rs#L195
warning: variants `RegisterGeneration` and `RegisterTrigger` are never constructed --> lnx-fs/src/page_cache/gc.rs:195:5 | 181 | enum GCEvent { | ------- variants in this enum ... 195 | RegisterGeneration { | ^^^^^^^^^^^^^^^^^^ ... 205 | RegisterTrigger { | ^^^^^^^^^^^^^^^
field `guard` is never read: lnx-fs/src/page_cache/gc.rs#L71
warning: field `guard` is never read --> lnx-fs/src/page_cache/gc.rs:71:5 | 69 | struct CacheGCActor { | ------------ field in this struct 70 | /// The guard marks the GC as dead when dropped. 71 | guard: ThreadLiveGuard, | ^^^^^ | = note: `CacheGCActor` has a derived impl for the trait `Default`, but this is intentionally ignored during dead code analysis
function `register_trigger` is never used: lnx-fs/src/page_cache/gc.rs#L50
warning: function `register_trigger` is never used --> lnx-fs/src/page_cache/gc.rs:50:15 | 50 | pub(crate) fn register_trigger<CB>( | ^^^^^^^^^^^^^^^^
function `track_generation` is never used: lnx-fs/src/page_cache/gc.rs#L38
warning: function `track_generation` is never used --> lnx-fs/src/page_cache/gc.rs:38:15 | 38 | pub(crate) fn track_generation(file_id: u64, generation_id: u64) { | ^^^^^^^^^^^^^^^^
methods `size`, `mark_to_be_freed`, and `write` are never used: lnx-fs/src/page_cache/block.rs#L140
warning: methods `size`, `mark_to_be_freed`, and `write` are never used --> lnx-fs/src/page_cache/block.rs:140:12 | 137 | impl MutPageRef { | --------------- methods in this implementation ... 140 | pub fn size(&self) -> usize { | ^^^^ ... 149 | pub(super) unsafe fn mark_to_be_freed(&mut self) { | ^^^^^^^^^^^^^^^^ ... 162 | pub(super) unsafe fn write(&mut self, buffer: &[u8]) { | ^^^^^
struct `MutPageRef` is never constructed: lnx-fs/src/page_cache/block.rs#L131
warning: struct `MutPageRef` is never constructed --> lnx-fs/src/page_cache/block.rs:131:19 | 131 | pub(super) struct MutPageRef { | ^^^^^^^^^^
function `get_num_pages` is never used: lnx-fs/src/page_cache/block.rs#L122
warning: function `get_num_pages` is never used --> lnx-fs/src/page_cache/block.rs:122:4 | 122 | fn get_num_pages(size: usize, page_size: usize) -> usize { | ^^^^^^^^^^^^^
multiple associated items are never used: lnx-fs/src/page_cache/block.rs#L25
warning: multiple associated items are never used --> lnx-fs/src/page_cache/block.rs:25:19 | 24 | impl VirtualFileBlock { | --------------------- associated items in this implementation 25 | pub(super) fn allocate(size: usize, page_size: PageSize) -> io::Result<Self> { | ^^^^^^^^ ... 43 | pub fn virtual_address_space_usage(&self) -> usize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... 48 | pub fn page_size(&self) -> PageSize { | ^^^^^^^^^ ... 54 | pub fn page_at(&self, page_id: PageId) -> &PageState { | ^^^^^^^ ... 60 | pub(super) unsafe fn pointer_to_page_id(&self, ptr: *const PageState) -> PageId { | ^^^^^^^^^^^^^^^^^^ ... 73 | pub(super) unsafe fn get_page_ptr(&self, page_id: PageId) -> *const u8 { | ^^^^^^^^^^^^ ... 87 | pub(super) unsafe fn get_mut_page(&self, page_id: PageId) -> MutPageRef { | ^^^^^^^^^^^^ ... 106 | pub(super) unsafe fn free_page(&self, page_id: PageId) { | ^^^^^^^^^
fields `mem`, `page_state_table`, and `page_size` are never read: lnx-fs/src/page_cache/block.rs#L16
warning: fields `mem`, `page_state_table`, and `page_size` are never read --> lnx-fs/src/page_cache/block.rs:16:5 | 12 | pub(super) struct VirtualFileBlock { | ---------------- fields in this struct ... 16 | mem: memmap2::MmapMut, | ^^^ 17 | /// A set of page states for the memory. 18 | page_state_table: PageStateTable, | ^^^^^^^^^^^^^^^^ ... 21 | page_size: PageSize, | ^^^^^^^^^
type alias `PageId` is never used: lnx-fs/src/page_cache/block.rs#L9
warning: type alias `PageId` is never used --> lnx-fs/src/page_cache/block.rs:9:10 | 9 | pub type PageId = usize; | ^^^^^^
methods `bytes_range`, `write`, `write_partial`, and `write_unchecked` are never used: lnx-fs/src/page_cache/mod.rs#L285
warning: methods `bytes_range`, `write`, `write_partial`, and `write_unchecked` are never used --> lnx-fs/src/page_cache/mod.rs:285:12 | 282 | impl WriteRequest { | ----------------- methods in this implementation ... 285 | pub fn bytes_range(&self) -> Range<usize> { | ^^^^^^^^^^^ ... 292 | pub fn write(self, buffer: &[u8]) { | ^^^^^ ... 309 | pub unsafe fn write_partial(self, buffer: &[u8]) { | ^^^^^^^^^^^^^ ... 328 | unsafe fn write_unchecked(mut self, buffer: &[u8]) { | ^^^^^^^^^^^^^^^
struct `WriteRequest` is never constructed: lnx-fs/src/page_cache/mod.rs#L271
warning: struct `WriteRequest` is never constructed --> lnx-fs/src/page_cache/mod.rs:271:12 | 271 | pub struct WriteRequest { | ^^^^^^^^^^^^
methods `outstanding_writes`, `try_finish`, `check_inflight_locks`, and `err_if_outstanding_writes` are never used: lnx-fs/src/page_cache/mod.rs#L158
warning: methods `outstanding_writes`, `try_finish`, `check_inflight_locks`, and `err_if_outstanding_writes` are never used --> lnx-fs/src/page_cache/mod.rs:158:12 | 154 | impl PreparedRead { | ----------------- methods in this implementation ... 158 | pub fn outstanding_writes(&self) -> &[WriteRequest] { | ^^^^^^^^^^^^^^^^^^ ... 166 | pub async fn try_finish(&mut self) -> Result<ReadRef, OutstandingWritesError> { | ^^^^^^^^^^ ... 203 | fn check_inflight_locks(&mut self) { | ^^^^^^^^^^^^^^^^^^^^ ... 256 | fn err_if_outstanding_writes(&self) -> Result<(), OutstandingWritesError> { | ^^^^^^^^^^^^^^^^^^^^^^^^^
struct `PreparedRead` is never constructed: lnx-fs/src/page_cache/mod.rs#L124
warning: struct `PreparedRead` is never constructed --> lnx-fs/src/page_cache/mod.rs:124:12 | 124 | pub struct PreparedRead { | ^^^^^^^^^^^^
methods `prepare_read` and `prepare_read_inner` are never used: lnx-fs/src/page_cache/mod.rs#L91
warning: methods `prepare_read` and `prepare_read_inner` are never used --> lnx-fs/src/page_cache/mod.rs:91:12 | 79 | impl FilePageCache { | ------------------ methods in this implementation ... 91 | pub fn prepare_read<K: Hash>( | ^^^^^^^^^^^^ ... 99 | fn prepare_read_inner(&self, file_id: u64) { | ^^^^^^^^^^^^^^^^^^
struct `FilePageCache` is never constructed: lnx-fs/src/page_cache/mod.rs#L69
warning: struct `FilePageCache` is never constructed --> lnx-fs/src/page_cache/mod.rs:69:12 | 69 | pub struct FilePageCache { | ^^^^^^^^^^^^^
static `PAGE_WRITE_WAKER` is never used: lnx-fs/src/page_cache/mod.rs#L46
warning: static `PAGE_WRITE_WAKER` is never used --> lnx-fs/src/page_cache/mod.rs:46:8 | 46 | static PAGE_WRITE_WAKER: [Notify; 32] = [const { Notify::const_new() }; 32]; | ^^^^^^^^^^^^^^^^
associated items `from_available_memory`, `num_bytes`, and `is_aligned` are never used: lnx-fs/src/config.rs#L44
warning: associated items `from_available_memory`, `num_bytes`, and `is_aligned` are never used --> lnx-fs/src/config.rs:44:12 | 42 | impl PageSize { | ------------- associated items in this implementation 43 | /// Returns the page size based on the available memory. 44 | pub fn from_available_memory(size_in_bytes: usize) -> Self { | ^^^^^^^^^^^^^^^^^^^^^ ... 62 | pub fn num_bytes(&self) -> usize { | ^^^^^^^^^ ... 68 | pub fn is_aligned(&self, pos: usize) -> bool { | ^^^^^^^^^^
variants `Size8KB`, `Size16KB`, `Size32KB`, and `Size64KB` are never constructed: lnx-fs/src/config.rs#L33
warning: variants `Size8KB`, `Size16KB`, `Size32KB`, and `Size64KB` are never constructed --> lnx-fs/src/config.rs:33:5 | 31 | pub enum PageSize { | -------- variants in this enum 32 | /// Use 8KB page size. 33 | Size8KB = 8 << 10, | ^^^^^^^ 34 | /// Use 16KB page size. 35 | Size16KB = 16 << 10, | ^^^^^^^^ 36 | /// Use 32KB page size. 37 | Size32KB = 32 << 10, | ^^^^^^^^ 38 | /// Use 64KB page size. 39 | Size64KB = 64 << 10, | ^^^^^^^^ | = note: `PageSize` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis = note: `#[warn(dead_code)]` on by default
unused variable: `file_id`: lnx-fs/src/page_cache/mod.rs#L99
warning: unused variable: `file_id` --> lnx-fs/src/page_cache/mod.rs:99:34 | 99 | fn prepare_read_inner(&self, file_id: u64) { | ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_file_id`
unused variable: `range`: lnx-fs/src/page_cache/mod.rs#L94
warning: unused variable: `range` --> lnx-fs/src/page_cache/mod.rs:94:9 | 94 | range: Range<usize>, | ^^^^^ help: if this is intentional, prefix it with an underscore: `_range`
unused variable: `file`: lnx-fs/src/page_cache/mod.rs#L93
warning: unused variable: `file` --> lnx-fs/src/page_cache/mod.rs:93:9 | 93 | file: K, | ^^^^ help: if this is intentional, prefix it with an underscore: `_file` | = note: `#[warn(unused_variables)]` on by default
unused import: `std::ops::Index`: lnx-fs/src/page_cache/block.rs#L2
warning: unused import: `std::ops::Index` --> lnx-fs/src/page_cache/block.rs:2:5 | 2 | use std::ops::Index; | ^^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default
clippy
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
clippy
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
clippy
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
clippy
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/