* [PATCH] file-posix: rearrange BDRVRawState fields
@ 2024-03-14 11:17 Prasad Pandit
2024-03-14 12:57 ` Stefan Hajnoczi
0 siblings, 1 reply; 2+ messages in thread
From: Prasad Pandit @ 2024-03-14 11:17 UTC (permalink / raw)
To: stefanha; +Cc: qemu-block, qemu-devel, kwolf, mtosatti, Prasad Pandit
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] file-posix: rearrange BDRVRawState fields
2024-03-14 11:17 [PATCH] file-posix: rearrange BDRVRawState fields Prasad Pandit
@ 2024-03-14 12:57 ` Stefan Hajnoczi
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2024-03-14 12:57 UTC (permalink / raw)
To: Prasad Pandit; +Cc: qemu-block, qemu-devel, kwolf, mtosatti, Prasad Pandit
[-- Attachment #1: Type: text/plain, Size: 492 bytes --]
On Thu, Mar 14, 2024 at 04:47:41PM +0530, Prasad Pandit wrote:
> 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(-)
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-03-14 12:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-14 11:17 [PATCH] file-posix: rearrange BDRVRawState fields Prasad Pandit
2024-03-14 12:57 ` Stefan Hajnoczi
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).