[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH 6/7] qcow2: make qcow2_cache_put() a void functi
From: |
Alberto Garcia |
Subject: |
Re: [Qemu-block] [PATCH 6/7] qcow2: make qcow2_cache_put() a void function |
Date: |
Fri, 08 May 2015 18:59:25 +0200 |
User-agent: |
Notmuch/0.13.2 (http://notmuchmail.org) Emacs/23.2.1 (i486-pc-linux-gnu) |
On Fri 08 May 2015 05:51:30 PM CEST, Max Reitz wrote:
>> -int qcow2_cache_put(BlockDriverState *bs, Qcow2Cache *c, void **table)
>> +void qcow2_cache_put(BlockDriverState *bs, Qcow2Cache *c, void **table)
>> {
>> int i = qcow2_cache_get_table_idx(bs, c, *table);
>>
>> - if (c->entries[i].offset == 0) {
>> - return -ENOENT;
>> - }
>> -
>
> Maybe you could replace it by assert(c->entries[i].offset != 0) just
> like in qcow2_cache_entry_mark_dirty() and similar to the assert() in
> qcow2_cache_get_table_idx()?
I guess the assert(c->entries[i].ref >= 0) at the end of the function
already covers that case (if offset == 0 then ref == 0 as well, so it
will be -1 by then).
Berto
- [Qemu-block] [PATCH 4/7] qcow2: remove qcow2_cache_find_entry_to_replace(), (continued)
- [Qemu-block] [PATCH 4/7] qcow2: remove qcow2_cache_find_entry_to_replace(), Alberto Garcia, 2015/05/06
- [Qemu-block] [PATCH 5/7] qcow2: use a hash to look for entries in the L2 cache, Alberto Garcia, 2015/05/06
- [Qemu-block] [PATCH 6/7] qcow2: make qcow2_cache_put() a void function, Alberto Garcia, 2015/05/06
- [Qemu-block] [PATCH 3/7] qcow2: use an LRU algorithm to replace entries from the L2 cache, Alberto Garcia, 2015/05/06
- [Qemu-block] [PATCH 1/7] qcow2: use one single memory block for the L2/refcount cache tables, Alberto Garcia, 2015/05/06