Re: [PATCH v2 08/28] list: add a new LRU list type

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

 



On 04/05/2013 05:20 AM, Dave Chinner wrote:
> On Thu, Apr 04, 2013 at 02:53:49PM -0700, Greg Thelen wrote:
>> On Fri, Mar 29 2013, Glauber Costa wrote:
>>> From: Dave Chinner <dchinner@xxxxxxxxxx>
>>> +long
>>> +list_lru_walk(
>>> +	struct list_lru *lru,
>>> +	list_lru_walk_cb isolate,
>>> +	void		*cb_arg,
>>> +	long		nr_to_walk)
>>> +{
>>> +	struct list_head *item, *n;
>>> +	long removed = 0;
>>> +restart:
>>> +	spin_lock(&lru->lock);
>>> +	list_for_each_safe(item, n, &lru->list) {
>>> +		int ret;
>>> +
>>> +		if (nr_to_walk-- < 0)
>>> +			break;
>>> +
>>> +		ret = isolate(item, &lru->lock, cb_arg);
>>> +		switch (ret) {
>>> +		case 0:	/* item removed from list */
>>> +			lru->nr_items--;
>>> +			removed++;
>>> +			break;
>>> +		case 1: /* item referenced, give another pass */
>>> +			list_move_tail(item, &lru->list);
>>> +			break;
>>> +		case 2: /* item cannot be locked, skip */
>>> +			break;
>>> +		case 3: /* item not freeable, lock dropped */
>>> +			goto restart;
>>
>> These four magic return values might benefit from an enum (or #define)
>> for clarity.
> 
> Obviously, and it was stated that this needed to be done by miself
> when I last posted the patch set many months ago. I've been rather
> busy since then, and so haven't had time to do anything with it.
> 
>> Maybe the names would be LRU_OK, LRU_REMOVED, LRU_ROTATE, LRU_RETRY.
> 
> Something like that...
> 
I can handle that and fold it with credits as usual if you don't mind.

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux