Re: [PATCH] bcache: try to reuse the slot of invalid_uuid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> 2022年6月6日 17:29,Zou Mingzhe <mingzhe.zou@xxxxxxxxxxxx> 写道:
> 
> 
> 
> 在 2022/6/6 16:57, Coly Li 写道:
>> 
>>> 2022年6月6日 16:45,mingzhe.zou@xxxxxxxxxxxx
>>>  写道:
>>> 
>>> From: mingzhe 
>>> <mingzhe.zou@xxxxxxxxxxxx>
>>> 
>>> 
>>> 
>>> 
>> [snipped]
>> 
>> 
>>> We want to use those invalid_uuid slots carefully. Because, the bkey of the inode
>>> may still exist in the btree. So, we need to check the btree before reuse it.
>>> 
>>> Signed-off-by: mingzhe 
>>> <mingzhe.zou@xxxxxxxxxxxx>
>>> 
>>> ---
>>> drivers/md/bcache/btree.c | 35 +++++++++++++++++++++++++++++++++++
>>> drivers/md/bcache/btree.h |  1 +
>>> drivers/md/bcache/super.c | 15 ++++++++++++++-
>>> 3 files changed, 50 insertions(+), 1 deletion(-)
>>> 
>>> diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c
>>> index e136d6edc1ed..a5d54af73111 100644
>>> --- a/drivers/md/bcache/btree.c
>>> +++ b/drivers/md/bcache/btree.c
>>> @@ -2755,6 +2755,41 @@ struct keybuf_key *bch_keybuf_next_rescan(struct cache_set *c,
>>> 	return ret;
>>> }
>>> 
>>> +static bool check_pred(struct keybuf *buf, struct bkey *k)
>>> +{
>>> +	return true;
>>> +}
>>> +
>>> +bool bch_btree_can_inode_reuse(struct cache_set *c, size_t inode)
>>> +{
>>> +	bool ret = true;
>>> +	struct keybuf_key *k;
>>> +	struct bkey end_key = KEY(inode, MAX_KEY_OFFSET, 0);
>>> +	struct keybuf *keys = kzalloc(sizeof(struct keybuf), GFP_KERNEL);
>>> +
>>> +	if (!keys) {
>>> +		ret = false;
>>> +		goto out;
>>> +	}
>>> +
>>> +	bch_keybuf_init(keys);
>>> +	keys->last_scanned = KEY(inode, 0, 0);
>>> +
>>> +	while (ret) {
>>> +		k = bch_keybuf_next_rescan(c, keys, &end_key, check_pred);
>>> +		if (!k)
>>> 
>> 
>> This is a single thread iteration, for a large filled cache device it can be very slow. I observed 40+ minutes during my testing.
>> 
>> 
>> Coly Li
>> 
>> 
> Hi, Coly
> 
> We first use the zero_uuid slot, and reuse only if there is no zero_uuid slot. This is just an imperfect solution to make bcache available, so we haven't tested its performance. We think we will eventually need to actively clean up these bkeys in a new thread and reset the invalid_uuid to zero_uuid.

Current method is the simplest, trust me, there is no much fun to play with register lock, writeback lock, and the btree node locks, live is not easy already...

Coly Li






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux ARM Kernel]     [Linux Filesystem Development]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux