mailarchive of the pengutronix oss-tools mailing list
 help / color / mirror / Atom feed
* [OSS-Tools] [PATCH 0/3] state: void partition table reread when possible
@ 2023-04-06 13:33 Ahmad Fatoum
  2023-04-06 13:33 ` [OSS-Tools] [PATCH 1/3] state: backend: direct: open block device in read-only mode if possible Ahmad Fatoum
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2023-04-06 13:33 UTC (permalink / raw)
  To: oss-tools

So far, barebox-state with a MMC backend always opened the whole disk
read/write, which triggers a partition table reread when closing the
device. This can be avoided in some cases:

  - If we are only interested in reading, we can open it O_RDONLY

  - If there happens to be an on-disk-described partition at exactly
    the region we are interested, we can open that instead.

So let's do that. The result can be easily verified with strace.
Without this patch:

  openat(AT_FDCWD, "/dev/mmcblk0", O_RDWR|O_LARGEFILE) = 4

With this patch:

  openat(AT_FDCWD, "/dev/mmcblk0p6", O_RDONLY|O_LARGEFILE) = 4

Ahmad Fatoum (3):
  state: backend: direct: open block device in read-only mode if
    possible
  libdt: factor out u64 sysattr parsing into helper
  libdt: use block device partition instead of parent if found

 src/barebox-state/backend_bucket_direct.c |   5 +-
 src/barebox-state/backend_storage.c       |   2 +-
 src/barebox-state/state.c                 |   6 +-
 src/barebox-state/state.h                 |   3 +-
 src/libdt.c                               | 104 +++++++++++++++++-----
 5 files changed, 92 insertions(+), 28 deletions(-)

-- 
2.39.2




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

end of thread, other threads:[~2023-04-06 13:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-06 13:33 [OSS-Tools] [PATCH 0/3] state: void partition table reread when possible Ahmad Fatoum
2023-04-06 13:33 ` [OSS-Tools] [PATCH 1/3] state: backend: direct: open block device in read-only mode if possible Ahmad Fatoum
2023-04-06 13:33 ` [OSS-Tools] [PATCH 2/3] libdt: factor out u64 sysattr parsing into helper Ahmad Fatoum
2023-04-06 13:33 ` [OSS-Tools] [PATCH 3/3] libdt: use block device partition instead of parent if found Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox