Message ID | 74e0e0ce58935bf1c285bf484e8f3beb0e3c8f66.1431967209.git.berto@igalia.com |
---|---|
State | New |
Headers | show |
On 18.05.2015 18:48, Alberto Garcia wrote: > Changing the current ordering saves 8 bytes per cache entry in x86_64. Hm, not seven? > Signed-off-by: Alberto Garcia <berto@igalia.com> > --- > block/qcow2-cache.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c > index a215f5b..43590ff 100644 > --- a/block/qcow2-cache.c > +++ b/block/qcow2-cache.c > @@ -31,9 +31,9 @@ > > typedef struct Qcow2CachedTable { > int64_t offset; > - bool dirty; > uint64_t lru_counter; > int ref; > + bool dirty; > } Qcow2CachedTable; > > struct Qcow2Cache { With "7" above, or an explanation why it actually is 8: Reviewed-by: Max Reitz <mreitz@redhat.com>
On 05/26/2015 10:10 AM, Max Reitz wrote: > On 18.05.2015 18:48, Alberto Garcia wrote: >> Changing the current ordering saves 8 bytes per cache entry in x86_64. > > Hm, not seven? > >> Signed-off-by: Alberto Garcia <berto@igalia.com> >> --- >> block/qcow2-cache.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c >> index a215f5b..43590ff 100644 >> --- a/block/qcow2-cache.c >> +++ b/block/qcow2-cache.c >> @@ -31,9 +31,9 @@ >> typedef struct Qcow2CachedTable { >> int64_t offset; >> - bool dirty; >> uint64_t lru_counter; >> int ref; >> + bool dirty; >> } Qcow2CachedTable; >> struct Qcow2Cache { > > With "7" above, or an explanation why it actually is 8: Old layout: 0-7 offset 8 dirty 9-15 padding 16-23 lru_counter 24-27 dirty 28-31 padding New layout: 0-7 offset 8-15 lru_counter 16-19 ref 20 dirty 21-23 padding It indeed saves 8 bytes. > > Reviewed-by: Max Reitz <mreitz@redhat.com> > >
On 05/18/2015 10:48 AM, Alberto Garcia wrote: > Changing the current ordering saves 8 bytes per cache entry in x86_64. > > Signed-off-by: Alberto Garcia <berto@igalia.com> > --- > block/qcow2-cache.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Eric Blake <eblake@redhat.com>
On 26.05.2015 18:12, Eric Blake wrote: > On 05/26/2015 10:10 AM, Max Reitz wrote: >> On 18.05.2015 18:48, Alberto Garcia wrote: >>> Changing the current ordering saves 8 bytes per cache entry in x86_64. >> Hm, not seven? >> >>> Signed-off-by: Alberto Garcia <berto@igalia.com> >>> --- >>> block/qcow2-cache.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c >>> index a215f5b..43590ff 100644 >>> --- a/block/qcow2-cache.c >>> +++ b/block/qcow2-cache.c >>> @@ -31,9 +31,9 @@ >>> typedef struct Qcow2CachedTable { >>> int64_t offset; >>> - bool dirty; >>> uint64_t lru_counter; >>> int ref; >>> + bool dirty; >>> } Qcow2CachedTable; >>> struct Qcow2Cache { >> With "7" above, or an explanation why it actually is 8: > Old layout: > > 0-7 offset > 8 dirty > 9-15 padding > 16-23 lru_counter > 24-27 dirty > 28-31 padding > > New layout: > > 0-7 offset > 8-15 lru_counter > 16-19 ref > 20 dirty > 21-23 padding > > It indeed saves 8 bytes. Oh, I forgot about the padding at the end. Thanks! Max >> Reviewed-by: Max Reitz <mreitz@redhat.com> >> >>
On Tue 26 May 2015 06:10:11 PM CEST, Max Reitz wrote: > On 18.05.2015 18:48, Alberto Garcia wrote: >> Changing the current ordering saves 8 bytes per cache entry in x86_64. > > Hm, not seven? No, the size is 32 before the patch and 24 afterwards. What you save is the 7 bytes of padding after 'dirty' and one of the bytes after 'ref'. >> typedef struct Qcow2CachedTable { >> int64_t offset; >> - bool dirty; >> uint64_t lru_counter; >> int ref; >> + bool dirty; >> } Qcow2CachedTable; Berto
diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c index a215f5b..43590ff 100644 --- a/block/qcow2-cache.c +++ b/block/qcow2-cache.c @@ -31,9 +31,9 @@ typedef struct Qcow2CachedTable { int64_t offset; - bool dirty; uint64_t lru_counter; int ref; + bool dirty; } Qcow2CachedTable; struct Qcow2Cache {
Changing the current ordering saves 8 bytes per cache entry in x86_64. Signed-off-by: Alberto Garcia <berto@igalia.com> --- block/qcow2-cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)