Re: [PATCH v2 1/3] xattr: extract kmem_xattr code from tmpfs
From: Hillf Danton
Date: Thu Mar 01 2012 - 07:42:50 EST
On Thu, Mar 1, 2012 at 2:17 PM, Li Zefan <lizf@xxxxxxxxxxxxxx> wrote:
> +/*
> + * free all the xattrs
> + */
> +void kmem_xattrs_free(struct kmem_xattrs *xattrs)
> +{
> + Â Â Â struct kmem_xattr *xattr, *node;
> +
> + Â Â Â spin_lock(&xattrs->lock);
> + Â Â Â list_for_each_entry_safe(xattr, node, &xattrs->head, list) {
> + Â Â Â Â Â Â Â kfree(xattr->name);
> + Â Â Â Â Â Â Â kfree(xattr);
> + Â Â Â }
> + Â Â Â spin_unlock(&xattrs->lock);
In your work it is a library function, operations on &xattrs->head
are no longer allowed, say list_empty(), after it called, though I
dunno if such operations exist.
And kmem_xattrs is too close to kmem_xattr, kmem_xattr_list
is not pron of typo.
-hd
> +}
> +
[...]
> @@ -559,10 +551,7 @@ static void shmem_evict_inode(struct inode *inode)
> Â Â Â Â} else
> Â Â Â Â Â Â Â Âkfree(info->symlink);
>
> - Â Â Â list_for_each_entry_safe(xattr, nxattr, &info->xattr_list, list) {
> - Â Â Â Â Â Â Â kfree(xattr->name);
> - Â Â Â Â Â Â Â kfree(xattr);
> - Â Â Â }
> + Â Â Â kmem_xattrs_free(&info->xattrs);
> Â Â Â ÂBUG_ON(inode->i_blocks);
> Â Â Â Âshmem_free_inode(inode->i_sb);
> Â Â Â Âend_writeback(inode);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/