* [PATCH] libfdisk: fdisk_deassign_device: only sync(2) blockdevs
@ 2024-01-13 22:35 наб
2024-01-15 9:40 ` Karel Zak
0 siblings, 1 reply; 2+ messages in thread
From: наб @ 2024-01-13 22:35 UTC (permalink / raw)
To: util-linux
[-- Attachment #1: Type: text/plain, Size: 719 bytes --]
When not editing a blockdev, syncing disks provides no benefit
(we already fsync() above), takes a long time,
and affects unrelated caches.
BLKRRPART is similarly gated on !S_ISBLK(st_mode) in
fdisk_reread_partition_table.
---
Based on the 2.39 tarball.
diff '--color=auto' -ru util-linux-2.39.orig/libfdisk/src/context.c util-linux-2.39/libfdisk/src/context.c
--- util-linux-2.39.orig/libfdisk/src/context.c 2023-05-11 10:24:24.840187437 +0200
+++ util-linux-2.39/libfdisk/src/context.c 2024-01-13 23:25:56.358057182 +0100
@@ -773,7 +773,7 @@
cxt->dev_path);
return -errno;
}
- if (!nosync) {
+ if (S_ISBLK(cxt->dev_st.st_mode) && !nosync) {
fdisk_info(cxt, _("Syncing disks."));
sync();
}
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] libfdisk: fdisk_deassign_device: only sync(2) blockdevs
2024-01-13 22:35 [PATCH] libfdisk: fdisk_deassign_device: only sync(2) blockdevs наб
@ 2024-01-15 9:40 ` Karel Zak
0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2024-01-15 9:40 UTC (permalink / raw)
To: наб; +Cc: util-linux
On Sat, Jan 13, 2024 at 11:35:31PM +0100, наб wrote:
> When not editing a blockdev, syncing disks provides no benefit
> (we already fsync() above), takes a long time,
> and affects unrelated caches.
>
> BLKRRPART is similarly gated on !S_ISBLK(st_mode) in
> fdisk_reread_partition_table.
Applied, thanks!
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-01-15 9:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-13 22:35 [PATCH] libfdisk: fdisk_deassign_device: only sync(2) blockdevs наб
2024-01-15 9:40 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).