mailarchive of the pengutronix oss-tools mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: oss-tools@pengutronix.de
Subject: [OSS-Tools] [PATCH 0/3] state: void partition table reread when possible
Date: Thu,  6 Apr 2023 15:33:18 +0200	[thread overview]
Message-ID: <20230406133321.3262437-1-a.fatoum@pengutronix.de> (raw)

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




             reply	other threads:[~2023-04-06 13:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-06 13:33 Ahmad Fatoum [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230406133321.3262437-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=oss-tools@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox