From 0ca94f5b531a18555092650ecda47e041ffe8685 Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Mon, 11 Dec 2023 14:37:28 +0000 Subject: [PATCH] re-add duration metrics --- pageserver/src/virtual_file.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pageserver/src/virtual_file.rs b/pageserver/src/virtual_file.rs index fb3aa8c4f9..5042aa5061 100644 --- a/pageserver/src/virtual_file.rs +++ b/pageserver/src/virtual_file.rs @@ -413,7 +413,7 @@ impl VirtualFile { } let (handle, mut slot_guard) = get_open_files().find_victim_slot().await; - slot_guard.file = Some({ + slot_guard.file = Some(observe_duration!(StorageIoOperation::Open, { let system = tokio_epoll_uring::thread_local_system().await; let file: OwnedFd = system .open(path, &open_options) @@ -426,7 +426,7 @@ impl VirtualFile { })?; let file = File::from(file); file - }); + })); // Strip all options other than read and write. // @@ -577,11 +577,19 @@ impl VirtualFile { // Copied from https://doc.rust-lang.org/1.72.0/src/std/os/unix/fs.rs.html#117-135 pub async fn read_exact_at( &self, + page: PageWriteGuard<'static>, + offset: u64, + ) -> Result, Error> { + with_file!(self, StorageIoOperation::Read, |file_guard| { + self.read_exact_at0(file_guard, page, offset).await + }) + } + async fn read_exact_at0( + &self, + file_guard: FileGuard<'static>, write_guard: PageWriteGuard<'static>, offset: u64, ) -> Result, Error> { - let file_guard: FileGuard<'static> = self.lock_file().await?; - let system = tokio_epoll_uring::thread_local_system().await; struct PageWriteGuardBuf { buf: PageWriteGuard<'static>,