Skip to content

Commit bc7bd96

Browse files
committed
Cleanup warnings
1 parent 53cc8c0 commit bc7bd96

4 files changed

Lines changed: 36 additions & 24 deletions

File tree

nvme/src/info.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,9 @@ pub fn get_zone_capacity(fd: RawFd, nsid: u32) -> Result<LogicalBlock, NVMeError
231231

232232
/// Returns the zone capacity for the given NVMe device and namespace.
233233
pub fn get_zone_state(fd: RawFd, nsid: u32, zone: Zone) -> Result<ZoneState, NVMeError> {
234-
Ok(report_zones_all(fd, nsid)?.1[zone as usize].zone_state.clone())
234+
Ok(report_zones_all(fd, nsid)?.1[zone as usize]
235+
.zone_state
236+
.clone())
235237
}
236238

237239
/// Returns a report of all zones for the given NVMe device and namespace.

oxcache/src/bin/spclient.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,16 @@ struct Cli {
5353

5454
#[derive(Debug, Clone)]
5555
struct TraceEntry {
56-
device: String,
56+
_device: String,
5757
lba: u64,
5858
size: u64,
59-
rw: String,
60-
timestamp: String,
59+
_rw: String,
60+
_timestamp: String,
6161
}
6262

6363
#[derive(Debug, Clone)]
6464
struct QuantizedRequest {
65-
original_lba: u64,
65+
_original_lba: u64,
6666
chunk_key: String,
6767
offset: u64,
6868
size: u64,
@@ -118,11 +118,11 @@ fn parse_trace(path: &str) -> Result<Vec<TraceEntry>, Box<dyn std::error::Error>
118118
continue;
119119
}
120120
entries.push(TraceEntry {
121-
device: fields[0].to_string(),
121+
_device: fields[0].to_string(),
122122
lba,
123123
size,
124-
rw: fields[3].to_string(),
125-
timestamp: fields[4].to_string(),
124+
_rw: fields[3].to_string(),
125+
_timestamp: fields[4].to_string(),
126126
});
127127
}
128128
_ => {
@@ -185,7 +185,7 @@ fn quantize_request(entry: &TraceEntry, chunk_size: u64) -> Vec<QuantizedRequest
185185
let chunk_key = format!("chunk_{}", chunk_num);
186186

187187
results.push(QuantizedRequest {
188-
original_lba: aligned_lba,
188+
_original_lba: aligned_lba,
189189
chunk_key,
190190
offset: offset_in_chunk,
191191
size: request_size,
@@ -571,11 +571,11 @@ mod tests {
571571
#[test]
572572
fn test_quantize_single_chunk() {
573573
let entry = TraceEntry {
574-
device: "dev0".to_string(),
574+
_device: "dev0".to_string(),
575575
lba: 0,
576576
size: 4096,
577-
rw: "R".to_string(),
578-
timestamp: "0".to_string(),
577+
_rw: "R".to_string(),
578+
_timestamp: "0".to_string(),
579579
};
580580

581581
let result = quantize_request(&entry, 65536);
@@ -588,11 +588,11 @@ mod tests {
588588
#[test]
589589
fn test_quantize_spanning_chunks() {
590590
let entry = TraceEntry {
591-
device: "dev0".to_string(),
591+
_device: "dev0".to_string(),
592592
lba: 4096,
593593
size: 20480,
594-
rw: "R".to_string(),
595-
timestamp: "0".to_string(),
594+
_rw: "R".to_string(),
595+
_timestamp: "0".to_string(),
596596
};
597597

598598
let result = quantize_request(&entry, 8192);
@@ -617,11 +617,11 @@ mod tests {
617617
#[test]
618618
fn test_quantize_unaligned() {
619619
let entry = TraceEntry {
620-
device: "dev0".to_string(),
620+
_device: "dev0".to_string(),
621621
lba: 100,
622622
size: 100,
623-
rw: "R".to_string(),
624-
timestamp: "0".to_string(),
623+
_rw: "R".to_string(),
624+
_timestamp: "0".to_string(),
625625
};
626626

627627
let result = quantize_request(&entry, 8192);
@@ -635,11 +635,11 @@ mod tests {
635635
#[test]
636636
fn test_quantize_chunk_boundary() {
637637
let entry = TraceEntry {
638-
device: "dev0".to_string(),
638+
_device: "dev0".to_string(),
639639
lba: 8192,
640640
size: 16384,
641-
rw: "R".to_string(),
642-
timestamp: "0".to_string(),
641+
_rw: "R".to_string(),
642+
_timestamp: "0".to_string(),
643643
};
644644

645645
let result = quantize_request(&entry, 8192);

oxcache/src/server.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,10 @@ async fn handle_connection<T: RemoteBackend + Send + Sync + 'static>(
518518
let start = Arc::clone(&start);
519519
let request_offset = request_offset;
520520
let request_size = request_size;
521+
522+
#[cfg(debug_assertions)]
521523
let request_uuid = request_uuid.clone();
524+
522525
move |data_source| async move {
523526
match data_source {
524527
DataSource::Ram(buffer_data) => {
@@ -580,7 +583,7 @@ async fn handle_connection<T: RemoteBackend + Send + Sync + 'static>(
580583

581584
tracing::debug!("REQ[{}] Waiting for read response", request_id);
582585
let recv_err = rx.recv_async().await;
583-
let (header, data) = match recv_err {
586+
let (_header, data) = match recv_err {
584587
Ok(wr) => {
585588
tracing::debug!("REQ[{}] Received read response from reader pool", request_id);
586589
match wr.data {
@@ -599,7 +602,7 @@ async fn handle_connection<T: RemoteBackend + Send + Sync + 'static>(
599602

600603
// Validate read response
601604
#[cfg(debug_assertions)]
602-
validate_read_response(&header, &request_uuid, 0, chunk_size);
605+
validate_read_response(&_header, &request_uuid, 0, chunk_size);
603606

604607
let chunked_resp = data;
605608

@@ -642,7 +645,10 @@ async fn handle_connection<T: RemoteBackend + Send + Sync + 'static>(
642645
let start = Arc::clone(&start);
643646
let request_offset = request_offset;
644647
let request_size = request_size;
648+
649+
#[cfg(debug_assertions)]
645650
let request_uuid = request_uuid.clone();
651+
646652
move |buffer_ref, notify_ref| async move {
647653
tracing::debug!("REQ[{}] CACHE MISS - entering remote fetch path", request_id);
648654
let resp = match remote.get(request_uuid.as_str(), 0, chunk_size).await {

oxcache/src/zone_state/zone_list.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
#[cfg(debug_assertions)]
12
use nvme::info::report_zones_all;
2-
use nvme::types::{Chunk, ZoneState};
3+
#[cfg(debug_assertions)]
4+
use nvme::types::ZoneState;
5+
use nvme::types::Chunk;
36

47
use crate::cache::bucket::ChunkLocation;
58
use crate::device;
@@ -599,6 +602,7 @@ impl ZoneList {
599602
}
600603

601604
/// Makes sure that the zone list is consistent with itself.
605+
#[cfg(debug_assertions)]
602606
fn check_invariants(&self) {
603607
// free_zones & open are unique and dont share elems
604608
{

0 commit comments

Comments
 (0)