mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
Replace qemu_real_host_page variables with inlined functions
Replace the global variables with inlined helper functions. getpagesize() is very likely annotated with a "const" function attribute (at least with glibc), and thus optimization should apply even better. This avoids the need for a constructor initialization too. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220323155743.1585078-12-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
b307e5052d
commit
8e3b0cbb72
53 changed files with 150 additions and 162 deletions
|
@ -386,7 +386,7 @@ static void raw_probe_alignment(BlockDriverState *bs, int fd, Error **errp)
|
|||
{
|
||||
BDRVRawState *s = bs->opaque;
|
||||
char *buf;
|
||||
size_t max_align = MAX(MAX_BLOCKSIZE, qemu_real_host_page_size);
|
||||
size_t max_align = MAX(MAX_BLOCKSIZE, qemu_real_host_page_size());
|
||||
size_t alignments[] = {1, 512, 1024, 2048, 4096};
|
||||
|
||||
/* For SCSI generic devices the alignment is not really used.
|
||||
|
@ -1261,7 +1261,7 @@ static void raw_refresh_limits(BlockDriverState *bs, Error **errp)
|
|||
raw_probe_alignment(bs, s->fd, errp);
|
||||
|
||||
bs->bl.min_mem_alignment = s->buf_align;
|
||||
bs->bl.opt_mem_alignment = MAX(s->buf_align, qemu_real_host_page_size);
|
||||
bs->bl.opt_mem_alignment = MAX(s->buf_align, qemu_real_host_page_size());
|
||||
|
||||
/*
|
||||
* Maximum transfers are best effort, so it is okay to ignore any
|
||||
|
@ -1886,7 +1886,7 @@ static int allocate_first_block(int fd, size_t max_size)
|
|||
size_t write_size = (max_size < MAX_BLOCKSIZE)
|
||||
? BDRV_SECTOR_SIZE
|
||||
: MAX_BLOCKSIZE;
|
||||
size_t max_align = MAX(MAX_BLOCKSIZE, qemu_real_host_page_size);
|
||||
size_t max_align = MAX(MAX_BLOCKSIZE, qemu_real_host_page_size());
|
||||
void *buf;
|
||||
ssize_t n;
|
||||
int ret;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue