[PATCH] XATTR issues on JFFS2

Kaigai Kohei kaigai at ak.jp.nec.com
Wed Sep 7 01:14:19 EDT 2005


Hello,

This attached patch enables XATTR support in JFFS2. (take-2)
# The contribution has slowed due to the trouble related to GC :-(

The my first patch posted in Aug 23 is revised at the points as follows.

- get/setxattr are implemented as a method of generic XATTR handler.
- new methods for "user.*" and "trusted.*" prefix were added.

- Time to retrieve the duplicate XATTR-cache shortened, when setxattr().
   In first implementation, we must scan all XATTR-cache to find the duplicate
   one, and it's so expensive. Now, we cau use the hash-list of XATTR-cache
   which is indexed by own contents.

- Now, Garbage Collector can deal JFFS2_NODETYPE_XATTR and JFFS2_NODETYPE_XREF.
   It seems to me that GC can mark unconditionally any nodes without inode
   as obsolete. But new JFFS2_NODETYPE_XATTR/XREF should be an exception.
   GC must not mark them as obsolete, although their "next_in_ino" is NULL.

   ----[ jffs2_garbage_collect_pass() in gc.c ]------------------------
   249  if (!raw->next_in_ino) {       <-- unconditionally mark it as obsolete.
   250      /* Inode-less node. Clean marker, snapshot or something like that */
   251      /* FIXME: If it's something that needs to be copied, including something
   252         we don't grok that has JFFS2_NODETYPE_RWCOMPAT_COPY, we should do so */
   253      spin_unlock(&c->erase_completion_lock);
   254      jffs2_mark_node_obsolete(c, raw);
   255      up(&c->alloc_sem);
   256      goto eraseit_lock;
   257  }
   --------------------------------------------------------------------

   I added a new variable 'owner' into jffs2_raw_node_ref to resolve this.
   It refers jffs2_xattr_cache or jffs2_xattr_ref object when raw-node reflect
   XATTR-node. Thus, we can distinguish XATTR-node and others by whether 'owner'
   is NULL or not.

- Consistency has improved.
   check_xattr_ref_ilist() checks XATTRs which are binded to same inode.
   If multiple XATTR has same name exist, older one is marked as obsolete.
   In first implementation, there are possibilities to be created multiple
   XATTRs have same name in an inode, when system-crash happens durling setxattr()

The remaining work is as follows:
  - Test & Stabilization.
  - The implementation for POSIX ACL support.
  - The implementation for XATTR support in mkfs.jffs2.

Signed-off-by: KaiGai Kohei <kaigai at ak.jp.nec.com>

Thanks,
-- 
Linux Promotion Center, NEC
KaiGai Kohei <kaigai at ak.jp.nec.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jffs2_xattr_take-2.patch
Type: text/x-patch
Size: 61039 bytes
Desc: not available
Url : http://lists.infradead.org/pipermail/linux-mtd/attachments/20050907/3c204215/attachment.bin 


More information about the linux-mtd mailing list