From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: "Gonglei (Arei)" <arei.gonglei@huawei.com>
Cc: "chenliang (T)" <chenliang88@huawei.com>,
Peter Maydell <peter.maydell@linaro.org>,
Juan Quintela <quintela@redhat.com>, "pl@kamp.de" <pl@kamp.de>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"aliguori@amazon.com" <aliguori@amazon.com>,
"pbonzini@redhat.com" <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 4/7] XBZRLE: rebuild the cache_is_cached function
Date: Fri, 28 Feb 2014 09:56:08 +0000 [thread overview]
Message-ID: <20140228095608.GE2695@work-vm> (raw)
In-Reply-To: <33183CC9F5247A488A2544077AF19020815D228D@SZXEMA503-MBS.china.huawei.com>
* Gonglei (Arei) (arei.gonglei@huawei.com) wrote:
> Rebuild the cache_is_cached function.
>
> Signed-off-by: ChenLiang <chenliang88@huawei.com>
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> ---
> page_cache.c | 33 +++++++++++++++------------------
> 1 file changed, 15 insertions(+), 18 deletions(-)
>
> diff --git a/page_cache.c b/page_cache.c
> index fa58ab2..34ec933 100644
> --- a/page_cache.c
> +++ b/page_cache.c
> @@ -121,24 +121,6 @@ static size_t cache_get_cache_pos(const PageCache *cache,
> return pos;
> }
>
> -bool cache_is_cached(const PageCache *cache, uint64_t addr,
> - uint64_t current_age)
> -{
> - size_t pos;
> -
> - g_assert(cache);
> - g_assert(cache->page_cache);
> -
> - pos = cache_get_cache_pos(cache, addr);
> -
> - if (cache->page_cache[pos].it_addr == addr) {
> - /* updata the it_age when the cache hit */
> - cache->page_cache[pos].it_age = current_age;
> - return true;
> - }
> - return false;
> -}
> -
> static CacheItem *cache_get_by_addr(const PageCache *cache, uint64_t addr)
> {
> size_t pos;
> @@ -156,6 +138,21 @@ uint8_t *get_cached_data(const PageCache *cache, uint64_t addr)
> return cache_get_by_addr(cache, addr)->it_data;
> }
>
> +bool cache_is_cached(const PageCache *cache, uint64_t addr,
> + uint64_t current_age)
> +{
> + CacheItem *it = NULL;
> +
> + it = cache_get_by_addr(cache, addr);
> +
> + if (it->it_addr == addr) {
> + /* updata the it_age when the cache hit */
> + it->it_age = current_age;
> + return true;
> + }
> + return false;
> +}
> +
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> int cache_insert(PageCache *cache, uint64_t addr, const uint8_t *pdata,
> uint64_t current_age)
> {
> --
> 1.7.12.4
>
> Best regards,
> -Gonglei
>
>
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2014-02-28 9:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-28 4:10 [Qemu-devel] [PATCH 4/7] XBZRLE: rebuild the cache_is_cached function Gonglei (Arei)
2014-02-28 9:56 ` Dr. David Alan Gilbert [this message]
2014-02-28 13:13 ` Eric Blake
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=20140228095608.GE2695@work-vm \
--to=dgilbert@redhat.com \
--cc=aliguori@amazon.com \
--cc=arei.gonglei@huawei.com \
--cc=chenliang88@huawei.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=pl@kamp.de \
--cc=qemu-devel@nongnu.org \
--cc=quintela@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 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).