public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup v2] api: zfs: create zpool with relatime=on
@ 2021-11-03  7:36 Dominik Csapak
  2021-12-15 14:59 ` Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2021-11-03  7:36 UTC (permalink / raw)
  To: pbs-devel

some operations (e.g. garbage collection/restore/etc.) are very read
intensive on the chunks, and having atime=on and relatime=off (zfs default)
makes those write intensive operations too. Additionally, 'ext4' defaults to
relatime, so also change the default for api-created zpools.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
changes from v1:
* do not disable atime, it must be on for relatime to work, quote
from 'man zfsprops' for 'relatime':

Controls the manner in which the access time is updated when atime=on is set.

 src/api2/node/disks/zfs.rs | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/api2/node/disks/zfs.rs b/src/api2/node/disks/zfs.rs
index 9c3a0958..56dedab5 100644
--- a/src/api2/node/disks/zfs.rs
+++ b/src/api2/node/disks/zfs.rs
@@ -273,13 +273,15 @@ pub fn create_zpool(
                 proxmox_systemd::enable_unit(&import_unit)?;
             }
 
+            let mut command = std::process::Command::new("zfs");
+            command.arg("set");
             if let Some(compression) = compression {
-                let mut command = std::process::Command::new("zfs");
-                command.args(&["set", &format!("compression={}", compression), &name]);
-                task_log!(worker, "# {:?}", command);
-                let output = pbs_tools::run_command(command, None)?;
-                task_log!(worker, "{}", output);
+                command.arg(&format!("compression={}", compression));
             }
+            command.args(&["relatime=on", &name]);
+            task_log!(worker, "# {:?}", command);
+            let output = pbs_tools::run_command(command, None)?;
+            task_log!(worker, "{}", output);
 
             if add_datastore {
                 let lock = pbs_config::datastore::lock_config()?;
-- 
2.30.2





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [pbs-devel] [PATCH proxmox-backup v2] api: zfs: create zpool with relatime=on
  2021-11-03  7:36 [pbs-devel] [PATCH proxmox-backup v2] api: zfs: create zpool with relatime=on Dominik Csapak
@ 2021-12-15 14:59 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2021-12-15 14:59 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Dominik Csapak

On 03.11.21 08:36, Dominik Csapak wrote:
> some operations (e.g. garbage collection/restore/etc.) are very read
> intensive on the chunks, and having atime=on and relatime=off (zfs default)
> makes those write intensive operations too. Additionally, 'ext4' defaults to
> relatime, so also change the default for api-created zpools.
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> changes from v1:
> * do not disable atime, it must be on for relatime to work, quote
> from 'man zfsprops' for 'relatime':
> 
> Controls the manner in which the access time is updated when atime=on is set.
> 
>  src/api2/node/disks/zfs.rs | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/src/api2/node/disks/zfs.rs b/src/api2/node/disks/zfs.rs
> index 9c3a0958..56dedab5 100644
> --- a/src/api2/node/disks/zfs.rs
> +++ b/src/api2/node/disks/zfs.rs
> @@ -273,13 +273,15 @@ pub fn create_zpool(
>                  proxmox_systemd::enable_unit(&import_unit)?;
>              }
>  
> +            let mut command = std::process::Command::new("zfs");
> +            command.arg("set");
>              if let Some(compression) = compression {
> -                let mut command = std::process::Command::new("zfs");
> -                command.args(&["set", &format!("compression={}", compression), &name]);
> -                task_log!(worker, "# {:?}", command);
> -                let output = pbs_tools::run_command(command, None)?;
> -                task_log!(worker, "{}", output);
> +                command.arg(&format!("compression={}", compression));
>              }
> +            command.args(&["relatime=on", &name]);
> +            task_log!(worker, "# {:?}", command);
> +            let output = pbs_tools::run_command(command, None)?;
> +            task_log!(worker, "{}", output);
>  
>              if add_datastore {
>                  let lock = pbs_config::datastore::lock_config()?;

looks good to me but would need a rebase on current master branch.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-15 15:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-03  7:36 [pbs-devel] [PATCH proxmox-backup v2] api: zfs: create zpool with relatime=on Dominik Csapak
2021-12-15 14:59 ` Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal