From: Prasad Pandit <ppandit@redhat.com>
To: stefanha@redhat.com
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, kwolf@redhat.com,
mtosatti@redhat.com, Prasad Pandit <pjp@fedoraproject.org>
Subject: [PATCH] file-posix: rearrange BDRVRawState fields
Date: Thu, 14 Mar 2024 16:47:41 +0530 [thread overview]
Message-ID: <20240314111741.1508705-1-ppandit@redhat.com> (raw)
From: Prasad Pandit <pjp@fedoraproject.org>
Rearrange BRDVRawState structure fields to avoid memory
fragments in its object's memory and save some(~8) bytes
per object.
Signed-off-by: Prasad Pandit <pjp@fedoraproject.org>
---
block/file-posix.c | 39 +++++++++++++++++++--------------------
1 file changed, 19 insertions(+), 20 deletions(-)
diff --git a/block/file-posix.c b/block/file-posix.c
index 78a8cea03b..584346ea3e 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -135,12 +135,6 @@
#define RAW_LOCK_SHARED_BASE 200
typedef struct BDRVRawState {
- int fd;
- bool use_lock;
- int type;
- int open_flags;
- size_t buf_align;
-
/* The current permissions. */
uint64_t perm;
uint64_t shared_perm;
@@ -151,29 +145,34 @@ typedef struct BDRVRawState {
uint64_t locked_shared_perm;
uint64_t aio_max_batch;
+ struct {
+ uint64_t discard_nb_ok;
+ uint64_t discard_nb_failed;
+ uint64_t discard_bytes_ok;
+ } stats;
+ PRManager *pr_mgr;
+ BDRVReopenState *reopen_state;
+
+ size_t buf_align;
+ int fd;
+ int type;
+ int open_flags;
int perm_change_fd;
int perm_change_flags;
- BDRVReopenState *reopen_state;
+ int page_cache_inconsistent; /* errno from fdatasync failure */
+ bool use_lock;
+ bool has_fallocate;
+ bool needs_alignment;
+ bool force_alignment;
+ bool drop_cache;
+ bool check_cache_dropped;
bool has_discard:1;
bool has_write_zeroes:1;
bool use_linux_aio:1;
bool has_laio_fdsync:1;
bool use_linux_io_uring:1;
- int page_cache_inconsistent; /* errno from fdatasync failure */
- bool has_fallocate;
- bool needs_alignment;
- bool force_alignment;
- bool drop_cache;
- bool check_cache_dropped;
- struct {
- uint64_t discard_nb_ok;
- uint64_t discard_nb_failed;
- uint64_t discard_bytes_ok;
- } stats;
-
- PRManager *pr_mgr;
} BDRVRawState;
typedef struct BDRVRawReopenState {
--
2.44.0
next reply other threads:[~2024-03-14 11:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-14 11:17 Prasad Pandit [this message]
2024-03-14 12:57 ` [PATCH] file-posix: rearrange BDRVRawState fields Stefan Hajnoczi
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=20240314111741.1508705-1-ppandit@redhat.com \
--to=ppandit@redhat.com \
--cc=kwolf@redhat.com \
--cc=mtosatti@redhat.com \
--cc=pjp@fedoraproject.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.