Skip to contentSkip to conversation

XATTR support on JFFS2 (version. 5)

PATCH In review KaiGai Kohei 6 participants 30 messages May 6, 2006 – May 13, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 XATTR support on JFFS2 (version. 5)

Hello,

This attached patches provide xattr support including POSIX-ACL and SELinux support on JFFS2 (version.5).
We can apply those patches to the latest git-tree.
- xattr_on_jffs2.kernel.version-5.patch can be applied to mtd-2.6.git.
- xattr_on_jffs2.utils.version-5.patch can be applied to mtd-utils.git.

There are some significant differences from previous version posted at last December.
The biggest change is addition of EBS(Erase Block Summary) support. Currently, both kernel and usermode utility (sumtool) can recognize xattr nodes which have JFFS2_NODETYPE_XATTR/_XREF nodetype.

In addition, some bugs are fixed.
- A potential race condition was fixed.
- Unexpected fail when updating a xattr by same name/value pair was fixed.
- A bug when removing xattr name/value pair was fixed.

The fundamental structures (such as using two new nodetypes and exclusion mechanism by rwsem) are unchanged. But most of implementation were reviewed and updated if necessary.
Espacially, we had to change several internal implementations related to load_xattr_datum() to avoid a potential race condition.

[1/2] xattr_on_jffs2.kernel.version-5.patch
[2/2] xattr_on_jffs2.utils.version-5.patch

We can get those patches from http://www.kaigai.gr.jp/
Any comments please. Thanks,

Signature · 1 line
KaiGai Kohei <[email protected]>
fs/Kconfig +38 -0
@@ -1075,6 +1075,44 @@ config JFFS2_FS_DEBUG
 	  If reporting bugs, please try to have available a full dump of the
 	  messages at debug level 1 while the misbehaviour was occurring.
 
+config JFFS2_FS_XATTR
+	bool "JFFS2 XATTR support"
+	depends on JFFS2_FS
+	default n
+	help
+	  Extended attributes are name:value pairs associated with inodes by
+	  the kernel or by users (see the attr(5) manual page, or visit
+	  <http://acl.bestbits.at/> for details).
+	  
+	  If unsure, say N.
+
+config JFFS2_FS_POSIX_ACL
+	bool "JFFS2 POSIX Access Control Lists"
+	depends on JFFS2_FS_XATTR
+	default y
+	select FS_POSIX_ACL
+	help
+	  Posix Access Control Lists (ACLs) support permissions for users and
+	  groups beyond the owner/group/world scheme.
+	  
+	  To learn more about Access Control Lists, visit the Posix ACLs for
+	  Linux website <http://acl.bestbits.at/>.
+	  
+	  If you don't know what Access Control Lists are, say N
+
+config JFFS2_FS_SECURITY
+	bool "JFFS2 Security Labels"
+	depends on JFFS2_FS_XATTR
+	default y
+	help
+	  Security labels support alternative access control models
+	  implemented by security modules like SELinux.  This option
+	  enables an extended attribute handler for file security
+	  labels in the jffs2 filesystem.
+	  
+	  If you are not using a security module that requires using
+	  extended attributes for file security labels, say N.
+
 config JFFS2_FS_WRITEBUFFER
 	bool "JFFS2 write-buffering support"
 	depends on JFFS2_FS
fs/jffs2/Makefile +3 -0
@@ -12,6 +12,9 @@ jffs2-y	+= symlink.o build.o erase.o bac
 jffs2-y	+= super.o debug.o
 
 jffs2-$(CONFIG_JFFS2_FS_WRITEBUFFER)	+= wbuf.o
+jffs2-$(CONFIG_JFFS2_FS_XATTR)		+= xattr.o xattr_trusted.o xattr_user.o
+jffs2-$(CONFIG_JFFS2_FS_SECURITY)	+= security.o
+jffs2-$(CONFIG_JFFS2_FS_POSIX_ACL)	+= acl.o
 jffs2-$(CONFIG_JFFS2_RUBIN)	+= compr_rubin.o
 jffs2-$(CONFIG_JFFS2_RTIME)	+= compr_rtime.o
 jffs2-$(CONFIG_JFFS2_ZLIB)	+= compr_zlib.o
fs/jffs2/acl.c +483 -0

483 lines not on this page · raw message

fs/jffs2/acl.h +46 -0

46 lines not on this page · raw message

fs/jffs2/build.c +2 -0
@@ -160,6 +160,7 @@ static int jffs2_build_filesystem(struct
 		ic->scan_dents = NULL;
 		cond_resched();
 	}
+	jffs2_build_xattr_subsystem(c);
 	c->flags &= ~JFFS2_SB_FLAG_BUILDING;
 
 	dbg_fsbuild("FS build complete\n");
@@ -178,6 +179,7 @@ exit:
 				jffs2_free_full_dirent(fd);
 			}
 		}
+		jffs2_clear_xattr_subsystem(c);
 	}
 
 	return ret;
fs/jffs2/debug.h +6 -0
@@ -171,6 +171,12 @@
 #define dbg_memalloc(fmt, ...)
 #endif
 
+/* Watch the XATTR subsystem */
+#ifdef JFFS2_DBG_XATTR_MESSAGES
+#define dbg_xattr(fmt, ...)  JFFS2_DEBUG(fmt, ##__VA_ARGS__)
+#else
+#define dbg_xattr(fmt, ...)
+#endif 
 
 /* "Sanity" checks */
 void
fs/jffs2/dir.c +56 -6

99 lines not on this page · raw message

fs/jffs2/file.c +6 -1
@@ -54,7 +54,12 @@ const struct file_operations jffs2_file_
 
 struct inode_operations jffs2_file_inode_operations =
 {
-	.setattr =	jffs2_setattr
+	.permission =	jffs2_permission,
+	.setattr =	jffs2_setattr,
+	.setxattr =	jffs2_setxattr,
+	.getxattr =	jffs2_getxattr,
+	.listxattr =	jffs2_listxattr,
+	.removexattr =	jffs2_removexattr
 };
 
 struct address_space_operations jffs2_file_address_operations =
fs/jffs2/fs.c +10 -1
@@ -185,7 +185,12 @@ static int jffs2_do_setattr (struct inod
 
 int jffs2_setattr(struct dentry *dentry, struct iattr *iattr)
 {
-	return jffs2_do_setattr(dentry->d_inode, iattr);
+	int rc;
+
+	rc = jffs2_do_setattr(dentry->d_inode, iattr);
+	if (!rc && (iattr->ia_valid & ATTR_MODE))
+		rc = jffs2_acl_chmod(dentry->d_inode);
+	return rc;
 }
 
 int jffs2_statfs(struct super_block *sb, struct kstatfs *buf)
@@ -224,6 +229,7 @@ void jffs2_clear_inode (struct inode *in
 
 	D1(printk(KERN_DEBUG "jffs2_clear_inode(): ino #%lu mode %o\n", inode->i_ino, inode->i_mode));
 
+	jffs2_xattr_delete_inode(c, f->inocache);
 	jffs2_do_clear_inode(c, f);
 }
 
@@ -497,6 +503,8 @@ int jffs2_do_fill_super(struct super_blo
 	}
 	memset(c->inocache_list, 0, INOCACHE_HASHSIZE * sizeof(struct jffs2_inode_cache *));
 
+	jffs2_init_xattr_subsystem(c);
+
 	if ((ret = jffs2_do_mount_fs(c)))
 		goto out_inohash;
 
@@ -531,6 +539,7 @@ int jffs2_do_fill_super(struct super_blo
 	else
 		kfree(c->blocks);
  out_inohash:
+	jffs2_clear_xattr_subsystem(c);
 	kfree(c->inocache_list);
  out_wbuf:
 	jffs2_flash_cleanup(c);
fs/jffs2/gc.c +15 -1
@@ -125,6 +125,7 @@ int jffs2_garbage_collect_pass(struct jf
 	struct jffs2_eraseblock *jeb;
 	struct jffs2_raw_node_ref *raw;
 	int ret = 0, inum, nlink;
+	int xattr = 0;
 
 	if (down_interruptible(&c->alloc_sem))
 		return -EINTR;
@@ -138,7 +139,7 @@ int jffs2_garbage_collect_pass(struct jf
 		   the node CRCs etc. Do it now. */
 
 		/* checked_ino is protected by the alloc_sem */
-		if (c->checked_ino > c->highest_ino) {
+		if (c->checked_ino > c->highest_ino && xattr) {
 			printk(KERN_CRIT "Checked all inodes but still 0x%x bytes of unchecked space?\n",
 			       c->unchecked_size);
 			jffs2_dbg_dump_block_lists_nolock(c);
@@ -148,6 +149,9 @@ int jffs2_garbage_collect_pass(struct jf
 
 		spin_unlock(&c->erase_completion_lock);
 
+		if (!xattr)
+			xattr = jffs2_verify_xattr(c);
+
 		spin_lock(&c->inocache_lock);
 
 		ic = jffs2_get_ino_cache(c, c->checked_ino++);
@@ -262,6 +266,16 @@ int jffs2_garbage_collect_pass(struct jf
 
 	ic = jffs2_raw_ref_to_ic(raw);
 
+	/* When 'ic' refers xattr_datum/xattr_ref, this node is GCed as xattr.
+	   We can decide whether this node is inode or xattr by ic->class.
+	   ret = 0 : ic is xattr_datum/xattr_ref, and GC was SUCCESSED.
+	   ret < 0 : ic is xattr_datum/xattr_ref, but GC was FAILED.
+	   ret > 0 : ic is NOT xattr_datum/xattr_ref.
+	*/
+	ret = jffs2_garbage_collect_xattr(c, ic);
+	if (ret <= 0)
+		goto release_sem;
+
 	/* We need to hold the inocache. Either the erase_completion_lock or
 	   the inocache_lock are sufficient; we trade down since the inocache_lock
 	   causes less contention. */
fs/jffs2/jffs2_fs_i.h +5 -0
@@ -5,6 +5,7 @@
 
 #include <linux/version.h>
 #include <linux/rbtree.h>
+#include <linux/posix_acl.h>
 #include <asm/semaphore.h>
 
 struct jffs2_inode_info {
@@ -45,6 +46,10 @@ struct jffs2_inode_info {
 	struct inode vfs_inode;
 #endif
 #endif
+#ifdef CONFIG_JFFS2_FS_POSIX_ACL
+	struct posix_acl *i_acl_access;
+	struct posix_acl *i_acl_default;
+#endif
 };
 
 #endif /* _JFFS2_FS_I */
fs/jffs2/jffs2_fs_sb.h +10 -0
@@ -115,6 +115,16 @@ struct jffs2_sb_info {
 
 	struct jffs2_summary *summary;		/* Summary information */
 
+#ifdef CONFIG_JFFS2_FS_XATTR
+#define XATTRINDEX_HASHSIZE	(57)
+	uint32_t highest_xid;
+	struct list_head xattrindex[XATTRINDEX_HASHSIZE];
+	struct list_head xattr_temp;
+	struct list_head xattr_unchecked;
+	struct rw_semaphore xattr_sem;
+	uint32_t xdatum_mem_usage;
+	uint32_t xdatum_mem_threshold;
+#endif
 	/* OS-private pointer for getting back to master superblock info */
 	void *os_priv;
 };
fs/jffs2/malloc.c +66 -2

89 lines not on this page · raw message

fs/jffs2/nodelist.c +1 -0
@@ -938,6 +938,7 @@ void jffs2_free_ino_caches(struct jffs2_
 		this = c->inocache_list[i];
 		while (this) {
 			next = this->next;
+			jffs2_xattr_free_inode(c, this);
 			jffs2_free_inode_cache(this);
 			this = next;
 		}
fs/jffs2/nodelist.h +20 -1
@@ -20,6 +20,8 @@
 #include <linux/jffs2.h>
 #include "jffs2_fs_sb.h"
 #include "jffs2_fs_i.h"
+#include "xattr.h"
+#include "acl.h"
 #include "summary.h"
 
 #ifdef __ECOS
@@ -107,11 +109,16 @@ struct jffs2_inode_cache {
 		temporary lists of dirents, and later must be set to
 		NULL to mark the end of the raw_node_ref->next_in_ino
 		chain. */
+	u8 class;	/* It's used for identification */
+	u8 flags;
+	uint16_t state;
 	struct jffs2_inode_cache *next;
 	struct jffs2_raw_node_ref *nodes;
 	uint32_t ino;
 	int nlink;
-	int state;
+#ifdef CONFIG_JFFS2_FS_XATTR
+	struct list_head ilist;
+#endif
 };
 
 /* Inode states for 'state' above. We need the 'GC' state to prevent
@@ -125,6 +132,12 @@ struct jffs2_inode_cache {
 #define INO_STATE_READING	5	/* In read_inode() */
 #define INO_STATE_CLEARING	6	/* In clear_inode() */
 
+#define INO_FLAGS_XATTR_CHECKED	0x01	/* has no duplicate xattr_ref */
+
+#define RAWNODE_CLASS_INODE_CACHE	0
+#define RAWNODE_CLASS_XATTR_DATUM	1
+#define RAWNODE_CLASS_XATTR_REF		2
+
 #define INOCACHE_HASHSIZE 128
 
 /*
@@ -374,6 +387,12 @@ struct jffs2_node_frag *jffs2_alloc_node
 void jffs2_free_node_frag(struct jffs2_node_frag *);
 struct jffs2_inode_cache *jffs2_alloc_inode_cache(void);
 void jffs2_free_inode_cache(struct jffs2_inode_cache *);
+#ifdef CONFIG_JFFS2_FS_XATTR
+struct jffs2_xattr_datum *jffs2_alloc_xattr_datum(void);
+void jffs2_free_xattr_datum(struct jffs2_xattr_datum *);
+struct jffs2_xattr_ref *jffs2_alloc_xattr_ref(void);
+void jffs2_free_xattr_ref(struct jffs2_xattr_ref *);
+#endif
 
 /* gc.c */
 int jffs2_garbage_collect_pass(struct jffs2_sb_info *c);
fs/jffs2/os-linux.h +4 -0
@@ -60,6 +60,10 @@ static inline void jffs2_init_inode_info
 	f->target = NULL;
 	f->flags = 0;
 	f->usercompr = 0;
+#ifdef CONFIG_JFFS2_FS_POSIX_ACL
+	f->i_acl_access = JFFS2_ACL_NOT_CACHED;
+	f->i_acl_default = JFFS2_ACL_NOT_CACHED;
+#endif
 }
 
 
fs/jffs2/readinode.c +1 -0
@@ -902,6 +902,7 @@ int jffs2_do_read_inode(struct jffs2_sb_
 		f->inocache->ino = f->inocache->nlink = 1;
 		f->inocache->nodes = (struct jffs2_raw_node_ref *)f->inocache;
 		f->inocache->state = INO_STATE_READING;
+		init_xattr_inode_cache(f->inocache);
 		jffs2_add_ino_cache(c, f->inocache);
 	}
 	if (!f->inocache) {
fs/jffs2/scan.c +168 -0

186 lines not on this page · raw message

fs/jffs2/security.c +82 -0

82 lines not on this page · raw message

fs/jffs2/summary.c +191 -0

231 lines not on this page · raw message

fs/jffs2/summary.h +42 -0

82 lines not on this page · raw message

fs/jffs2/super.c +5 -1
@@ -151,7 +151,10 @@ static struct super_block *jffs2_get_sb_
 
 	sb->s_op = &jffs2_super_operations;
 	sb->s_flags = flags | MS_NOATIME;
-
+	sb->s_xattr = jffs2_xattr_handlers;
+#ifdef CONFIG_JFFS2_FS_POSIX_ACL
+	sb->s_flags |= MS_POSIXACL;
+#endif
 	ret = jffs2_do_fill_super(sb, data, flags & MS_SILENT ? 1 : 0);
 
 	if (ret) {
@@ -293,6 +296,7 @@ static void jffs2_put_super (struct supe
 		kfree(c->blocks);
 	jffs2_flash_cleanup(c);
 	kfree(c->inocache_list);
+	jffs2_clear_xattr_subsystem(c);
 	if (c->mtd->sync)
 		c->mtd->sync(c->mtd);
 
fs/jffs2/symlink.c +6 -1
@@ -24,7 +24,12 @@ struct inode_operations jffs2_symlink_in
 {
 	.readlink =	generic_readlink,
 	.follow_link =	jffs2_follow_link,
-	.setattr =	jffs2_setattr
+	.permission =	jffs2_permission,
+	.setattr =	jffs2_setattr,
+	.setxattr =	jffs2_setxattr,
+	.getxattr =	jffs2_getxattr,
+	.listxattr =	jffs2_listxattr,
+	.removexattr =	jffs2_removexattr
 };
 
 static void *jffs2_follow_link(struct dentry *dentry, struct nameidata *nd)
fs/jffs2/write.c +1 -1
@@ -36,7 +36,7 @@ int jffs2_do_new_inode(struct jffs2_sb_i
 	f->inocache->nlink = 1;
 	f->inocache->nodes = (struct jffs2_raw_node_ref *)f->inocache;
 	f->inocache->state = INO_STATE_PRESENT;
-
+	init_xattr_inode_cache(f->inocache);
 
 	jffs2_add_ino_cache(c, f->inocache);
 	D1(printk(KERN_DEBUG "jffs2_do_new_inode(): Assigned ino# %d\n", f->inocache->ino));
fs/jffs2/xattr.c +1271 -0

1,271 lines not on this page · raw message

fs/jffs2/xattr.h +120 -0

119 lines not on this page · raw message

fs/jffs2/xattr_trusted.c +51 -0

51 lines not on this page · raw message

fs/jffs2/xattr_user.c +51 -0

51 lines not on this page · raw message

include/linux/jffs2.h +40 -0

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

include/linux/jffs2.h +40 -0
diff -prNU3 mtd-utils.git/include/linux/jffs2.h mtd-utils.xattr/include/linux/jffs2.h

Lines of this file are not shown. View the raw message.

include/mtd/jffs2-user.h +47 -0

47 lines not on this page · raw message

mkfs.jffs2.1 +18 -0

Lines of this file are not shown. View the raw message.

mkfs.jffs2.c +259 -0

259 lines not on this page · raw message

summary.h +38 -0

Lines of this file are not shown. View the raw message.

sumtool.c +132 -1

133 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

maintainer
#1 lore raw
Quoted 7 lines · KaiGai Kohei

Hello,

This attached patches provide xattr support including POSIX-ACL and SELinux support on JFFS2 (version.5).
We can apply those patches to the latest git-tree.
- xattr_on_jffs2.kernel.version-5.patch can be applied to mtd-2.6.git.
- xattr_on_jffs2.utils.version-5.patch can be applied to mtd-utils.git.

Thank you. These patches look good to me, in general. I do have a couple of minor comments to make, but I'll do that with a slightly shorter Cc list.

In the meantime I've committed the utils patch directly to the mtd-utils git tree at git://git.infradead.org/mtd-utils.git and I have created a new kernel git tree at git://git.infradead.org/jffs2-xattr-2.6.git.
(Both of these are browsable at http://git.infradead.org for non-git users).

I've created a new git tree for the kernel side because I want Linus to pull from the existing MTD git tree immediately after he releases 2.6.17, and I'd like the xattr code to be in public view (and the -mm tree) for a bit longer than that. As soon as Linus releases 2.6.17 and pulls from the MTD tree for 2.6.18, I intend to pull the xattr code into the main mtd tree -- as long as other reviewers are happy. OK?

Signature · 1 line
dwmw2
maintainer
#2 lore raw
Quoted 3 lines · David Woodhouse

Thank you. These patches look good to me, in general. I do have a couple of minor comments to make, but I'll do that with a slightly shorter Cc list.

As I said, it looks good in general. A few minor points though. I haven't looked _too_ hard yet at the details, but this is what jumped out at me when I scrolled through it.

1. Please don't use typedefs. Just 'struct jffs2_acl_header' instead of this:

	typedef struct {
	       jint32_t        a_version;
	} jffs2_acl_header;

2. You're adding locks without documenting them in README.Locking. Please make sure any new locks (c->xattr_sem) are fully documented.

3. You have very strange locking behaviour in jffs2_garbage_collect_xattr() -- sometimes you return with the lock still held, sometimes without. I think it would be best to check ic->class within the jffs2_garbage_collect_passs() function instead.

4. You add a list_head to struct jffs2_inode_cache. That's two pointers -- could we get away with only a single pointer instead?

How much has your code been tested on SMP machines?

Please let me know if you'd like an account with direct access to the jffs2-xattr-2.6.git tree. I can continue to apply patches if you prefer, but git is quite easy to use.

Signature · 1 line
dwmw2
#3 lore raw

Thanks for your comments.

Quoted 5 lines

1. Please don't use typedefs. Just 'struct jffs2_acl_header' instead of this:

	typedef struct {
	       jint32_t        a_version;
	} jffs2_acl_header;

OK, I'll fix it.

Quoted 2 lines

2. You're adding locks without documenting them in README.Locking. Please make sure any new locks (c->xattr_sem) are fully documented.

OK, I'll prepare it.
Please notice me, if storange English expressions are included.

Quoted 4 lines

3. You have very strange locking behaviour in jffs2_garbage_collect_xattr() -- sometimes you return with the lock still held, sometimes without. I think it would be best to check ic->class within the jffs2_garbage_collect_passs() function instead.

Do you prefer the following style implementation?
I also agree your opinion, if so. I'll fix it.

@ gc.c

    if (jffs2_garbage_collect_passs(c, ic)) {  /* returns 1, if ic is xdatum or xref */
        spin_unlock(&c->erase_completion_lock);
        jffs2_garbage_collect_xattr(c, ic);    /* ic is xdatum or xref */
        goto release_sem;
    }
        :
Quoted 2 lines

4. You add a list_head to struct jffs2_inode_cache. That's two pointers -- could we get away with only a single pointer instead?

It's probably possible. Please wait for a while, since there is a bit much points to be fixed.

Quoted 1 line

How much has your code been tested on SMP machines?

It's not evaluated on SMP machine yet.
(And, I've not prepated SMP evaluation environment yet.) I hope to make collaboration with MTD people.

Quoted 3 lines

Please let me know if you'd like an account with direct access to the jffs2-xattr-2.6.git tree. I can continue to apply patches if you prefer, but git is quite easy to use.

I haven't known much about detailed git operations yet. But I'm already doing basical operations such as pull/push/... in my local environment. Maybe, here is not significant problem. I'm willing to manage jffs2-xattr-2.6.git tree. Is it necessary to send you my ssh public key, isn't it?

Thanks,

Signature · 1 line
KaiGai Kohei <[email protected]>
maintainer
#4 lore raw
Quoted 1 line · KaiGai Kohei

OK, I'll fix it.

<...>

Quoted 2 lines

OK, I'll prepare it.
Please notice me, if storange English expressions are included.

OK, thanks. I'm happy to proof-read for you.

Quoted 8 lines
Quoted 4 lines

3. You have very strange locking behaviour in jffs2_garbage_collect_xattr() -- sometimes you return with the lock still held, sometimes without. I think it would be best to check ic->class within the jffs2_garbage_collect_passs() function instead.

Do you prefer the following style implementation?
I also agree your opinion, if so. I'll fix it.

Quoted 6 lines

@ gc.c

    if (jffs2_garbage_collect_passs(c, ic)) {  /* returns 1, if ic is xdatum or xref */
        spin_unlock(&c->erase_completion_lock);
        jffs2_garbage_collect_xattr(c, ic);    /* ic is xdatum or xref */
        goto release_sem;
    }

I don't like that very much either, to be honest. How about getting rid of jffs2_garbage_collect_xattr() altogether, and using this in gc.c instead...

#ifdef CONFIG_JFFS2_FS_XATTR
	/* When 'ic' refers xattr_datum/xattr_ref, this node is GCed as xattr.
	   We can decide whether this node is inode or xattr by ic->class. */
	if (ic->class == RAWNODE_CLASS_XATTR_DATUM ||
	    ic->class == RAWNODE_CLASS_XATTR_REF) {
		spin_unlock(&c->erase_completion_lock);
	/* XXXXXX? */
		down_write(&c->xattr_sem);
		if (ic->class == RAWNODE_CLASS_XATTR_DATUM)
			ret = jffs2_garbage_collect_xattr_datum(c, (void *)ic);
		else
			ret = jffs2_garbage_collect_xattr_ref(c, (void *)ic);
		up_write(&c->xattr_sem);
		goto release_sem;
	}

#endif

Quoted 6 lines
Quoted 3 lines

4. You add a list_head to struct jffs2_inode_cache. That's two pointers -- could we get away with only a single pointer instead?

It's probably possible. Please wait for a while, since there is a bit much points to be fixed.

OK, thanks. I think it's worth doing, because there will be many instances of struct jffs2_inode_cache, and it's best to keep them as small as possible.

Quoted 5 lines
Quoted 1 line

How much has your code been tested on SMP machines?

It's not evaluated on SMP machine yet.
(And, I've not prepated SMP evaluation environment yet.) I hope to make collaboration with MTD people.

Any SMP machine will work, using the 'mtdram' driver instead of real flash.

Quoted 4 lines

I haven't known much about detailed git operations yet. But I'm already doing basical operations such as pull/push/... in my local environment. Maybe, here is not significant problem. I'm willing to manage jffs2-xattr-2.6.git tree. Is it necessary to send you my ssh public key, isn't it?

Yes, please. I'll add an account for you.

Signature · 1 line
dwmw2
#5 lore raw

Hello,

Quoted 19 lines · David Woodhouse

I don't like that very much either, to be honest. How about getting rid of jffs2_garbage_collect_xattr() altogether, and using this in gc.c instead...

#ifdef CONFIG_JFFS2_FS_XATTR
	/* When 'ic' refers xattr_datum/xattr_ref, this node is GCed as xattr.
	   We can decide whether this node is inode or xattr by ic->class. */
	if (ic->class == RAWNODE_CLASS_XATTR_DATUM ||
	    ic->class == RAWNODE_CLASS_XATTR_REF) {
		spin_unlock(&c->erase_completion_lock);
	/* XXXXXX? */
		down_write(&c->xattr_sem);
		if (ic->class == RAWNODE_CLASS_XATTR_DATUM)
			ret = jffs2_garbage_collect_xattr_datum(c, (void *)ic);
		else
			ret = jffs2_garbage_collect_xattr_ref(c, (void *)ic);
		up_write(&c->xattr_sem);
		goto release_sem;
	}
Quoted 1 line

#endif

OK, I'll fix according to your suggestion.
Only one point, I think xattr_sem should be modified in xattr.c for readability.

Quoted 7 lines
Quoted 4 lines

I haven't known much about detailed git operations yet. But I'm already doing basical operations such as pull/push/... in my local environment. Maybe, here is not significant problem. I'm willing to manage jffs2-xattr-2.6.git tree. Is it necessary to send you my ssh public key, isn't it?

Yes, please. I'll add an account for you.

I'll send it to you directly.

Thanks,

Signature · 1 line
KaiGai Kohei <[email protected]>
maintainer
#6 lore raw
Quoted 3 lines · KaiGai Kohei

OK, I'll fix according to your suggestion.
Only one point, I think xattr_sem should be modified in xattr.c for readability.

Yes, you are probably right.

Signature · 1 line
dwmw2
#7 lore raw
In reply to David Woodhouse
Quoted 3 lines · David Woodhouse

Any SMP machine will work, using the 'mtdram' driver instead of real flash.

Yes, I aways use an i686 boxen + a RAM flash simulator for development - saves a great deal of time.

Signature · 3 lines
Best Regards,
Artem B. Bityutskiy,
St.-Petersburg, Russia.
maintainer
#9 lore raw
Quoted 1 line · Artem B. Bityutskiy

BTW, is xattr being friends with summary?

Quoted 3 lines · KaiGai Kohei

There are some significant differences from previous version posted at last December.
The biggest change is addition of EBS(Erase Block Summary) support.

Signature · 1 line
dwmw2
#10 lore raw
In reply to KaiGai Kohei
Quoted 7 lines · KaiGai Kohei

Hello,

This attached patches provide xattr support including POSIX-ACL and SELinux support on JFFS2 (version.5).
We can apply those patches to the latest git-tree.
- xattr_on_jffs2.kernel.version-5.patch can be applied to mtd-2.6.git.
- xattr_on_jffs2.utils.version-5.patch can be applied to mtd-utils.git

I've quickly glanced at the xattr.h file.

Quoted 1 line

+/*-------------------------------------------------------------------------*

Quoted 1 line

+ * File: fs/jffs2/xattr.c

Not sure it makes sense to specify file name here.

Quoted 1 line

+#include <linux/xattr.h>

You're using 'struct list_head' in your 'xattr.h' file, wouldn't it be a good tone to add #include <linux/lists.h> then?

Quoted 10 lines
fs/jffs2/xattr.h +10 -0
+struct jffs2_xattr_datum
+{
+	void *always_null;
+	u8 class;
+	u8 flags;
+	u16 xprefix;			/* see JFFS2_XATTR_PREFIX_* */
+
+	struct jffs2_raw_node_ref *node;
+	struct list_head xindex;	/* chained from c->xattrindex[n] */
+	uint32_t refcnt;		/* # of xattr_ref refers this */

fs/jffs2/xattr.h line 38

Quoted 10 lines
fs/jffs2/xattr.h +10 -0
+	uint32_t xid;
+	uint32_t version;
+
+	uint32_t data_crc;
+	uint32_t hashkey;
+	char *xname;		/* XATTR name without prefix */
+	uint32_t name_len;	/* length of xname */
+	char *xvalue;		/* XATTR value */
+	uint32_t value_len;	/* length of xvalue */
+};

Would be cuter to use Linux-style comments.

Quoted 1 line

+struct jffs2_inode_cache; /* forward refence */

A classic example of a senseless comment :-)

Quoted 1 line

+extern struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct

jffs2_sb_info *c,

Quoted 1 line

+ uint32_t xid,

uint32_t version);

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+extern void jffs2_xattr_delete_inode(struct jffs2_sb_info *c, struct

jffs2_inode_cache *ic);

Quoted 1 line

+extern void jffs2_xattr_free_inode(struct jffs2_sb_info *c, struct

jffs2_inode_cache *ic);

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+extern int jffs2_garbage_collect_xattr(struct jffs2_sb_info *c,

struct jffs2_inode_cache *ic);
I wouldn't follow old JFFS2 style and would not exceed the 80-characters per line limit.

fs/jffs2/xattr.h line 90

Quoted 2 lines
fs/jffs2/xattr.h +2 -0
+/*---- Any inline initialize functions ----*/
+#define init_xattr_inode_cache(x) INIT_LIST_HEAD(&((x)->ilist))

Wierd comment.

Signature · 3 lines
Best Regards,
Artem B. Bityutskiy,
St.-Petersburg, Russia.
#11 lore raw

Hi, few refinements,

Quoted 17 lines · Artem B. Bityutskiy
Quoted 1 line

+#include <linux/xattr.h>

You're using 'struct list_head' in your 'xattr.h' file, wouldn't it be a good tone to add #include <linux/lists.h> then?

Quoted 13 lines
fs/jffs2/xattr.h +13 -0
+struct jffs2_xattr_datum
+{
+	void *always_null;
+	u8 class;
+	u8 flags;
+	u16 xprefix;			/* see JFFS2_XATTR_PREFIX_* */
+
+	struct jffs2_raw_node_ref *node;
+	struct list_head xindex;	/* chained from c->xattrindex[n] */
+	uint32_t refcnt;		/* # of xattr_ref refers this */
+	uint32_t xid;
+	uint32_t version;
+
Quoted 8 lines

fs/jffs2/xattr.h line 38

Quoted 7 lines
fs/jffs2/xattr.h +7 -0
+	uint32_t data_crc;
+	uint32_t hashkey;
+	char *xname;		/* XATTR name without prefix */
+	uint32_t name_len;	/* length of xname */
+	char *xvalue;		/* XATTR value */
+	uint32_t value_len;	/* length of xvalue */
+};

Would be cuter to use Linux-style comments.

I mean, this is not a requirement, this is just my opinion. But David is the maintainer, and he does not agree here, so please, ignore this.

Quoted 2 lines
Quoted 1 line

+struct jffs2_inode_cache; /* forward refence */

A classic example of a senseless comment :-)

Err, sorry, I meant, this comment is not really useful and might be removed.

Quoted 3 lines

fs/jffs2/xattr.h line 90

Quoted 2 lines
fs/jffs2/xattr.h +2 -0
+/*---- Any inline initialize functions ----*/
+#define init_xattr_inode_cache(x) INIT_LIST_HEAD(&((x)->ilist))

Wierd comment.

How about to just remove this comment?

Signature · 3 lines
Best Regards,
Artem B. Bityutskiy,
St.-Petersburg, Russia.
maintainer
#12 lore raw
In reply to Artem B. Bityutskiy
Quoted 3 lines · Artem B. Bityutskiy

+/*-------------------------------------------------------------------------*

Quoted 1 line

+ * File: fs/jffs2/xattr.c

Not sure it makes sense to specify file name here.

It's a common thing to do though; I don't think it matters much.

I would prefer to to have a consistent 'header' across all the JFFS2 files though -- I would have been inclined to copy the form used in those. It's purely cosmetic though.

Quoted 3 lines
Quoted 1 line

+#include <linux/xattr.h>

You're using 'struct list_head' in your 'xattr.h' file, wouldn't it be a good tone to add #include <linux/lists.h> then?

Yes, it's good practice to include the header files you need directly, rather than relying on the C file to include stuff like <linux/list.h> before including "xattr.h".

It's not inefficient -- the compiler has a special optimisation where it notices the 'include guards' we put around header files (#ifndef __LIST_H\n#define __LIST_H\n....#endif) and doesn't even _open_ the header file the second time it's included.

Quoted 14 lines
Quoted 14 lines
fs/jffs2/xattr.h +14 -0
+struct jffs2_xattr_datum
+{
+	void *always_null;
+	u8 class;
+	u8 flags;
+	u16 xprefix;			/* see JFFS2_XATTR_PREFIX_* */
+
+	struct jffs2_raw_node_ref *node;
+	struct list_head xindex;	/* chained from c->xattrindex[n] */
+	uint32_t refcnt;		/* # of xattr_ref refers this */
+	uint32_t xid;
+	uint32_t version;
+
+	uint32_t data_crc;
Quoted 8 lines

fs/jffs2/xattr.h line 38

Quoted 6 lines
fs/jffs2/xattr.h +6 -0
+	uint32_t hashkey;
+	char *xname;		/* XATTR name without prefix */
+	uint32_t name_len;	/* length of xname */
+	char *xvalue;		/* XATTR value */
+	uint32_t value_len;	/* length of xvalue */
+};

Would be cuter to use Linux-style comments.

I think Artem is referring to kernel-doc style comments, which look like this...

/**
* struct jffs2_xattr_datum - inode_cache equivalent for XATTR data *
* @always_null: Equivalent of ic->scan_dents. Must be NULL
* @class: Used to distinguish from jffs2_inode_cache/jffs2_xattr_ref
...

I suppose it _might_ be nice if we were to do kerneldoc-style comments all through JFFS2, and create a proper set of documentation for the source code. I don't think it's fair to expert _you_ to start on that though; there's plenty of work for Artem to do first if he wants that.

Personally, I prefer the comments _with_ the struct members, on the right-hand-side as you've placed them. I'd want to keep those even if we _do_ also have the kerneldoc comments which produce _external_ documentation for printing.

Quoted 2 lines
Quoted 1 line

+struct jffs2_inode_cache; /* forward refence */

A classic example of a senseless comment :-)

Yes, it's best to avoid commenting on things which don't need it.

Quoted 10 lines

fs/jffs2/xattr.h line 72

Quoted 7 lines
fs/jffs2/xattr.h +7 -0
+extern struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c,
+                                                  uint32_t xid, uint32_t version);
+
+extern void jffs2_xattr_delete_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic);
+extern void jffs2_xattr_free_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic);
+
+extern int jffs2_garbage_collect_xattr(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic);

I wouldn't follow old JFFS2 style and would not exceed the 80-characters per line limit.

Even in prototypes? I disagree. Limiting yourself to 80 characters just makes it messier.

Quoted 3 lines

fs/jffs2/xattr.h line 90

Quoted 2 lines
fs/jffs2/xattr.h +2 -0
+/*---- Any inline initialize functions ----*/
+#define init_xattr_inode_cache(x) INIT_LIST_HEAD(&((x)->ilist))

Wierd comment.

I think it was meant to read something like:

/*----- inline initialisation functions -----*/

But yes, since there's only one 'function' defined there and it's fairly obvious that it's an initialisation function, the comment is probably not needed.

If all Artem can come up with is cosmetics, then I'm sure we're doing well :)

Signature · 1 line
dwmw2
#13 lore raw

Hi, David and Aterm.
Thanks for your comments.

Quoted 11 lines · David Woodhouse
Quoted 3 lines · Artem B. Bityutskiy

+/*-------------------------------------------------------------------------*

Quoted 1 line

+ * File: fs/jffs2/xattr.c

Not sure it makes sense to specify file name here.

It's a common thing to do though; I don't think it matters much.

I would prefer to to have a consistent 'header' across all the JFFS2 files though -- I would have been inclined to copy the form used in those. It's purely cosmetic though.

I agree. The file header part at xattr.[ch], acl.[ch], security.c, xattr_user.c and xattr_trusted.c should be updated.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

+#include <linux/xattr.h>

You're using 'struct list_head' in your 'xattr.h' file, wouldn't it be a good tone to add #include <linux/lists.h> then?

Yes, it's good practice to include the header files you need directly, rather than relying on the C file to include stuff like <linux/list.h> before including "xattr.h".

OK, I'll fix it.

Quoted 38 lines
Quoted 14 lines
Quoted 14 lines
fs/jffs2/xattr.h +14 -0
+struct jffs2_xattr_datum
+{
+	void *always_null;
+	u8 class;
+	u8 flags;
+	u16 xprefix;			/* see JFFS2_XATTR_PREFIX_* */
+
+	struct jffs2_raw_node_ref *node;
+	struct list_head xindex;	/* chained from c->xattrindex[n] */
+	uint32_t refcnt;		/* # of xattr_ref refers this */
+	uint32_t xid;
+	uint32_t version;
+
+	uint32_t data_crc;
Quoted 8 lines

fs/jffs2/xattr.h line 38

Quoted 6 lines
fs/jffs2/xattr.h +6 -0
+	uint32_t hashkey;
+	char *xname;		/* XATTR name without prefix */
+	uint32_t name_len;	/* length of xname */
+	char *xvalue;		/* XATTR value */
+	uint32_t value_len;	/* length of xvalue */
+};

Would be cuter to use Linux-style comments.

I think Artem is referring to kernel-doc style comments, which look like this...

/**
* struct jffs2_xattr_datum - inode_cache equivalent for XATTR data *
* @always_null: Equivalent of ic->scan_dents. Must be NULL
* @class: Used to distinguish from jffs2_inode_cache/jffs2_xattr_ref
...

I suppose it _might_ be nice if we were to do kerneldoc-style comments all through JFFS2, and create a proper set of documentation for the source code. I don't think it's fair to expert _you_ to start on that though; there's plenty of work for Artem to do first if he wants that.

Quoted 4 lines

Personally, I prefer the comments _with_ the struct members, on the right-hand-side as you've placed them. I'd want to keep those even if we _do_ also have the kerneldoc comments which produce _external_ documentation for printing.

I'll follow the common style on jffs2 implementation, when we can arrive at an agreement. Now, I hope to suspend it.

Quoted 4 lines
Quoted 2 lines
Quoted 1 line

+struct jffs2_inode_cache; /* forward refence */

A classic example of a senseless comment :-)

Yes, it's best to avoid commenting on things which don't need it.

I'll remove it.
(Futhermore, it's wrong in spelling. orz)

Quoted 11 lines
Quoted 10 lines

fs/jffs2/xattr.h line 72

Quoted 7 lines
fs/jffs2/xattr.h +7 -0
+extern struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c,
+                                                  uint32_t xid, uint32_t version);
+
+extern void jffs2_xattr_delete_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic);
+extern void jffs2_xattr_free_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic);
+
+extern int jffs2_garbage_collect_xattr(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic);

I wouldn't follow old JFFS2 style and would not exceed the 80-characters per line limit.

Quoted 2 lines

Even in prototypes? I disagree. Limiting yourself to 80 characters just makes it messier.

I'll follow the common style on jffs2 implementation, when we can arrive at an agreement. Now, I hope to suspend it.

Quoted 6 lines
Quoted 3 lines

fs/jffs2/xattr.h line 90

Quoted 2 lines
fs/jffs2/xattr.h +2 -0
+/*---- Any inline initialize functions ----*/
+#define init_xattr_inode_cache(x) INIT_LIST_HEAD(&((x)->ilist))

Wierd comment.

I think it was meant to read something like:

Quoted 8 lines

/*----- inline initialisation functions -----*/

But yes, since there's only one 'function' defined there and it's fairly obvious that it's an initialisation function, the comment is probably not needed.

If all Artem can come up with is cosmetics, then I'm sure we're doing well :)

Ah, some inline functions were defined here at the previous versions of xattr patches. This comment remained with old information.

Futhermore, init_xattr_inode_cache() will become also unnecesary because 'list_head ilist' will be replaced by 'struct jffs2_xattr_ref *xref' and 'xref' will be initialized as NULL by memset(ic, 0, sizeof(*ic)). David suggested me to use single direction list instead of list_head for memory usage reduction at previous reply.

Thus, I'll remove both this comment and definition of init_xattr_inode_cache().

Thanks,

Signature · 2 lines
Open Source Software Promotion Center, NEC
KaiGai Kohei <[email protected]>
#14 lore raw
In reply to KaiGai Kohei

The code already looks quite good on the surface. Finding deeper problems takes more time, which I lack. So there are not many comments in this round.

fs/jffs2/acl.c line 52

Quoted 4 lines · KaiGai Kohei
fs/jffs2/acl.c +4 -0
+
+static struct posix_acl *jffs2_acl_from_medium(const void *value, size_t size)
+{
+	const char *end = (char *)value + size;

This cast appears to be unnecessary. Gcc has an extention that allows arithmetic on void* pointers. The behaviour is just as if the pointer was casted to unsigned long and back - quite useful.

fs/jffs2/acl.c line 61

Quoted 1 line
fs/jffs2/acl.c +1 -0
+	ver = je32_to_cpu(((jffs2_acl_header *)value)->a_version);

In this case, it might make sense to create a local variable:

	jffs2_acl_header *header = value;
	...
	ver = je32_to_cpu(header->a_version);

If only a single field is used from the header, this is a matter of taste. If it occurs more often, the local variable helps with readability.

fs/jffs2/acl.c line 67

Quoted 1 line
fs/jffs2/acl.c +1 -0
+	value = (char *)value + sizeof(jffs2_acl_header);

Can be removed.

fs/jffs2/acl.c line 79

Quoted 2 lines
fs/jffs2/acl.c +2 -0
+	for (i=0; i < count; i++) {
+		jffs2_acl_entry *entry = (jffs2_acl_entry *)value;

This cast can be removed. void* can implicitly be cast to any pointer type. Also, would it be possible to move this variable to the beginning of the function and use it for the version check?

fs/jffs2/acl.c line 80

Quoted 1 line
fs/jffs2/acl.c +1 -0
+		if ((char *)value + sizeof(jffs2_acl_entry_short) > end)

This and two more can be removed.

There is a reason to remove explicit casts whereever possible - and why a strongly typed language like C++ can cause problems. With every explicit cast, the compiler has to assume that everything is correct here, even if it isn't. And if explicit casts are used everywhere in the source, a human will usually do the same and ignore bugs that should have been obvious.

In C, esp. with the gcc extension for void* arithmetic, explicit casts are very rarely needed. And those few cases are easily checked by humans for correctness.

Strong typing can also help to avoid bugs, but usually 95% of the code is better off with weak typing, as in C. Some of the remaining cases are caught by sparse with __bitwise and friends, so by my estimate 99% of the code is better off without strong typing.

fs/jffs2/acl.c line 120

Quoted 1 line
fs/jffs2/acl.c +1 -0
+	jffs2_acl = (jffs2_acl_header *)kmalloc(sizeof(jffs2_acl_header)

kmalloc() returns a void*, so no explicit cast is needed.

fs/jffs2/acl.c line 149

Quoted 1 line
fs/jffs2/acl.c +1 -0
+	return (char *)jffs2_acl;

And this function returns void*, so this explicit cast isn't needed either.

fs/jffs2/acl.h

Quoted 3 lines
fs/jffs2/acl.h +0 -0
@@ -0,0 +1,46 @@

#ifndef JFFS2_ACL_H
#define JFFS2_ACL_H
...
#endif

Quoted 12 lines
fs/jffs2/acl.h +12 -0
+#ifdef __KERNEL__
+#ifdef CONFIG_JFFS2_FS_POSIX_ACL
+
+#define JFFS2_ACL_NOT_CACHED ((void *)-1)
+
+extern int jffs2_permission(struct inode *, int, struct nameidata *);
+extern int jffs2_acl_chmod(struct inode *);
+extern int jffs2_init_acl(struct inode *, struct inode *);
+extern void jffs2_clear_acl(struct inode *);
+
+extern struct xattr_handler jffs2_acl_access_xattr_handler;
+extern struct xattr_handler jffs2_acl_default_xattr_handler;

fs/jffs2/acl.h line 46

Quoted 10 lines
fs/jffs2/acl.h +10 -0
+
+#else
+
+#define jffs2_permission NULL
+#define jffs2_acl_chmod(inode)		(0)
+#define jffs2_init_acl(inode,dir)	(0)
+#define jffs2_clear_acl(inode)
+
+#endif	/* CONFIG_JFFS2_FS_POSIX_ACL */
+#endif	/* __KERNEL__ */

The kernel is in a fairly bad shape wrt. seperating userspace interface and in-kernel headers. dwmw2 is currently trying to sort things out. Splitting this part into a seperate file would make his job a bit easier.

Quoted 6 lines
fs/jffs2/acl.h +2 -0
@@ -107,11 +109,16 @@ struct jffs2_inode_cache {
 		temporary lists of dirents, and later must be set to
 		NULL to mark the end of the raw_node_ref->next_in_ino
 		chain. */
+	u8 class;	/* It's used for identification */
+	u8 flags;

fs/jffs2/acl.h struct jffs2_inode_cache { · line 122

Quoted 10 lines
fs/jffs2/acl.h +4 -1
+	uint16_t state;
 	struct jffs2_inode_cache *next;
 	struct jffs2_raw_node_ref *nodes;
 	uint32_t ino;
 	int nlink;
-	int state;
+#ifdef CONFIG_JFFS2_FS_XATTR
+	struct list_head ilist;
+#endif
 };

Why does this field depend on CONFIG_JFFS2_FS_XATTR, while the above doesn't? It looks as if splitting state into several fields is a generic cleanup and can be merged independently of xattr support.

Quoted 1 line

[...]

Overall, the code looks nicer than most of the current jffs2, that is good. What worries me a bit is the number of #ifdef's in it. In sufficient number, those can make any code unmaintainable. In the headers and in malloc.c, they are fine. In other files, it would be good if they could get removed somehow.

Jörn

Signature · 2 lines
He who knows that enough is enough will always have enough.
-- Lao Tsu
#15 lore raw

Hi, Jörn. Thanks for your comments.

Quoted 9 lines · KaiGai Kohei

fs/jffs2/acl.c line 52

Quoted 4 lines
fs/jffs2/acl.c +4 -0
+
+static struct posix_acl *jffs2_acl_from_medium(const void *value, size_t size)
+{
+	const char *end = (char *)value + size;

This cast appears to be unnecessary. Gcc has an extention that allows arithmetic on void* pointers. The behaviour is just as if the pointer was casted to unsigned long and back - quite useful.

Hmm, I'll review the implementation and reduce the unnecessary casts.

Quoted 10 lines

fs/jffs2/acl.c line 61

Quoted 1 line
fs/jffs2/acl.c +1 -0
+	ver = je32_to_cpu(((jffs2_acl_header *)value)->a_version);

In this case, it might make sense to create a local variable:

	jffs2_acl_header *header = value;
	...
	ver = je32_to_cpu(header->a_version);

If only a single field is used from the header, this is a matter of taste. If it occurs more often, the local variable helps with readability.

The most of posix-acl implementation on jffs2 is mede with referring to ext2/3's implementation. The jffs2_acl_header structure is reflection of ext2_acl_header.
I also think using local variable is good idea for readability. I'll fix it.

Quoted 10 lines

fs/jffs2/acl.c line 67

Quoted 1 line
fs/jffs2/acl.c +1 -0
+	value = (char *)value + sizeof(jffs2_acl_header);

Can be removed.

fs/jffs2/acl.c line 79

Quoted 2 lines
fs/jffs2/acl.c +2 -0
+	for (i=0; i < count; i++) {
+		jffs2_acl_entry *entry = (jffs2_acl_entry *)value;

This cast can be removed. void* can implicitly be cast to any pointer type. Also, would it be possible to move this variable to the beginning of the function and use it for the version check?

jffs2_acl_header is used for version checking, not jffs2_acl_entry. Thus, it's not possible to use version checking. But I'll remove unnecessary cast.

Quoted 8 lines

fs/jffs2/acl.c line 120

Quoted 1 line
fs/jffs2/acl.c +1 -0
+	jffs2_acl = (jffs2_acl_header *)kmalloc(sizeof(jffs2_acl_header)

kmalloc() returns a void*, so no explicit cast is needed.

fs/jffs2/acl.c line 149

Quoted 1 line
fs/jffs2/acl.c +1 -0
+	return (char *)jffs2_acl;

And this function returns void*, so this explicit cast isn't needed either.

I agreed. Those should be reduced.

Quoted 7 lines

#ifndef JFFS2_ACL_H
#define JFFS2_ACL_H
...
#endif

fs/jffs2/acl.h line 26

Quoted 2 lines
fs/jffs2/acl.h +2 -0
+#ifdef __KERNEL__
+#ifdef CONFIG_JFFS2_FS_POSIX_ACL

... <snip> ...

Quoted 7 lines

fs/jffs2/acl.h line 46

Quoted 2 lines
fs/jffs2/acl.h +2 -0
+#endif	/* CONFIG_JFFS2_FS_POSIX_ACL */
+#endif	/* __KERNEL__ */

The kernel is in a fairly bad shape wrt. seperating userspace interface and in-kernel headers. dwmw2 is currently trying to sort things out. Splitting this part into a seperate file would make his job a bit easier.

Because 'acl.h' was shared by mkfs.jffs2 at previous version of xattr patches. But the __KERNEL__ ifdef block is unnecessary now. I'll remove it.

Quoted 12 lines
Quoted 12 lines
fs/jffs2/nodelist.h +3 -1
@@ -107,11 +109,16 @@ struct jffs2_inode_cache {
 		temporary lists of dirents, and later must be set to
 		NULL to mark the end of the raw_node_ref->next_in_ino
 		chain. */
+	u8 class;	/* It's used for identification */
+	u8 flags;
+	uint16_t state;
 	struct jffs2_inode_cache *next;
 	struct jffs2_raw_node_ref *nodes;
 	uint32_t ino;
 	int nlink;
-	int state;
Quoted 8 lines

fs/jffs2/nodelist.h struct jffs2_inode_cache { · line 122

Quoted 4 lines
fs/jffs2/nodelist.h +3 -0
+#ifdef CONFIG_JFFS2_FS_XATTR
+	struct list_head ilist;
+#endif
 };

Why does this field depend on CONFIG_JFFS2_FS_XATTR, while the above doesn't? It looks as if splitting state into several fields is a generic cleanup and can be merged independently of xattr support.

If ilist would be always enabled, it will enforce any users the amount of 2 * sizeof(void *) bytes memory usage increase per inode_cache whether they hope to use xattr or not regardless of.
Thus, this field is defined with depending on CONFIG_JFFS2_FS_XATTR.

About the state variable, I splited it into three variable unconditionaly because it didn't have such a bad effect (if int has 32-bit width).

Thanks,

[Current TODO list]
* Fix the declaration of jffs2_acl_header and so on by using 'struct' instead of 'typedef' in kernel space.
- Fix the declaration of jffs2_acl_header and so on by using 'struct' instead of 'typedef' in user space header.
* Add documentation about xattr_sem into README.Locking.
* Call jffs2_garbage_collect_xattr_datum/ref() from gc.c directly instead of jffs2_garbage_collect_xattr()
- Use unidirection list beween inode_chache and xattr_ref, instead of list_head.
- Add '#include <linux/list.h>' into xattr.h.
- Unify each file header part with any jffs2 files.
- Remove a senseless comment. ("/* forward refence */")
- Remove unneccesary pointer casts.
- Remove unneccesary '#ifdef __KERNEL__' on acl.h

*: It has already prepared, but I've not publicated yet. -: It has not prepated yet. I should work from now.

Signature · 2 lines
Open Source Software Promotion Center, NEC
KaiGai Kohei <[email protected]>
maintainer
#16 lore raw
Quoted 16 lines · KaiGai Kohei

[Current TODO list]
* Fix the declaration of jffs2_acl_header and so on by using 'struct' instead of 'typedef' in kernel space.
- Fix the declaration of jffs2_acl_header and so on by using 'struct' instead of 'typedef' in user space header.
* Add documentation about xattr_sem into README.Locking.
* Call jffs2_garbage_collect_xattr_datum/ref() from gc.c directly instead of jffs2_garbage_collect_xattr()
- Use unidirection list beween inode_chache and xattr_ref, instead of list_head.
- Add '#include <linux/list.h>' into xattr.h.
- Unify each file header part with any jffs2 files.
- Remove a senseless comment. ("/* forward refence */")
- Remove unneccesary pointer casts.
- Remove unneccesary '#ifdef __KERNEL__' on acl.h

Quoted 2 lines

*: It has already prepared, but I've not publicated yet. -: It has not prepated yet. I should work from now.

That's an excellent summary; thanks. It does serve to show that we've mostly picked on cosmetic details so far though :)

If you have patches committed into a git tree, you should be able to just 'git-push ssh://git.infradead.org/home/git/jffs2-xattr-2.6.git' to make it available.

Signature · 1 line
dwmw2
#17 lore raw

Hi,

Some fixes and updates on the todo list are already pushed to git://git.infradead.org/jffs2-xattr-2.6.git .

The broken-out patches are available at here:
http://www.kaigai.gr.jp/index.php?FrontPage#vd169842

01. jffs2-xattr-v5.1-01-remove_typedef_kernel.patch
02. jffs2-xattr-v5.1-02-remove_typedef_utils.patch
03. jffs2-xattr-v5.1-03-append_README.Locking.patch
04. jffs2-xattr-v5.1-04-remove_ilist_from_ic.patch
05. jffs2-xattr-v5.1-05-update_xattr_gc.patch
06. jffs2-xattr-v5.1-06-add_list.h.patch
07. jffs2-xattr-v5.1-07-unify_file_header.patch
08. jffs2-xattr-v5.1-08-remove_senseless_comment.patch
09. jffs2-xattr-v5.1-09-remove__KERNEL__.patch
10. jffs2-xattr-v5.1-10-remove_pointer_cast.patch

I hope to merge the second patch (jffs2-xattr-v5.1-02-remove_typedef_utils.patch), because this patch is for mtd-utils.git, not jffs2-xattr-2.6.git.

P.S.
Thanks David for your introduction about git on infradead.org.

Quoted 28 lines · David Woodhouse
Quoted 16 lines · KaiGai Kohei

[Current TODO list]
* Fix the declaration of jffs2_acl_header and so on by using 'struct' instead of 'typedef' in kernel space.
- Fix the declaration of jffs2_acl_header and so on by using 'struct' instead of 'typedef' in user space header.
* Add documentation about xattr_sem into README.Locking.
* Call jffs2_garbage_collect_xattr_datum/ref() from gc.c directly instead of jffs2_garbage_collect_xattr()
- Use unidirection list beween inode_chache and xattr_ref, instead of list_head.
- Add '#include <linux/list.h>' into xattr.h.
- Unify each file header part with any jffs2 files.
- Remove a senseless comment. ("/* forward refence */")
- Remove unneccesary pointer casts.
- Remove unneccesary '#ifdef __KERNEL__' on acl.h

Quoted 2 lines

*: It has already prepared, but I've not publicated yet. -: It has not prepated yet. I should work from now.

That's an excellent summary; thanks. It does serve to show that we've mostly picked on cosmetic details so far though :)

If you have patches committed into a git tree, you should be able to just 'git-push ssh://git.infradead.org/home/git/jffs2-xattr-2.6.git' to make it available.

Signature · 1 line
KaiGai Kohei <[email protected]>
include/mtd/jffs2-user.h +12 -12
index 8b53990..bc5d99a 100644
@@ -50,33 +50,33 @@ extern int target_endian;
 #define XATTR_TRUSTED_PREFIX		"trusted."
 #define XATTR_TRUSTED_PREFIX_LEN	(sizeof (XATTR_TRUSTED_PREFIX) - 1)
 
-typedef struct {
+struct jffs2_acl_entry {
 	jint16_t	e_tag;
 	jint16_t	e_perm;
 	jint32_t	e_id;
-} jffs2_acl_entry;
+};
 
-typedef struct {
+struct jffs2_acl_entry_short {
 	jint16_t	e_tag;
 	jint16_t	e_perm;
-} jffs2_acl_entry_short;
+};
 
-typedef struct {
+struct jffs2_acl_header {
 	jint32_t	a_version;
-} jffs2_acl_header;
+};
 
 /* copied from include/linux/posix_acl_xattr.h */
 #define POSIX_ACL_XATTR_VERSION 0x0002
 
-typedef struct {
+struct posix_acl_xattr_entry {
 	uint16_t		e_tag;
 	uint16_t		e_perm;
 	uint32_t		e_id;
-} posix_acl_xattr_entry;
+};
 
-typedef struct {
-	uint32_t		a_version;
-	posix_acl_xattr_entry	a_entries[0];
-} posix_acl_xattr_header;
+struct posix_acl_xattr_header {
+	uint32_t			a_version;
+	struct posix_acl_xattr_entry	a_entries[0];
+};
 
 #endif /* __JFFS2_USER_H__ */
mkfs.jffs2.c +14 -14
index 02f57f9..fa4a5f3 100644
@@ -1052,22 +1052,22 @@ static struct {
 	{ 0, NULL, 0 }
 };
 
-static void formalize_posix_acl(char *xvalue, int *value_len)
+static void formalize_posix_acl(void *xvalue, int *value_len)
 {
-	posix_acl_xattr_header *pacl_header;
-	posix_acl_xattr_entry *pent, *plim;
-	jffs2_acl_header *jacl_header;
-	jffs2_acl_entry *jent;
-	jffs2_acl_entry_short *jent_s;
+	struct posix_acl_xattr_header *pacl_header;
+	struct posix_acl_xattr_entry *pent, *plim;
+	struct jffs2_acl_header *jacl_header;
+	struct jffs2_acl_entry *jent;
+	struct jffs2_acl_entry_short *jent_s;
 	char buffer[XATTR_BUFFER_SIZE];
 	int offset = 0;
 
-	pacl_header = (posix_acl_xattr_header *)xvalue;;
+	pacl_header = xvalue;;
 	pent = pacl_header->a_entries;
-	plim = (posix_acl_xattr_entry *)(xvalue + *value_len);
+	plim = xvalue + *value_len;
 
-	jacl_header = (jffs2_acl_header *)buffer;
-	offset += sizeof(jffs2_acl_header);
+	jacl_header = (struct jffs2_acl_header *)buffer;
+	offset += sizeof(struct jffs2_acl_header);
 	jacl_header->a_version = cpu_to_je32(JFFS2_ACL_VERSION);
 
 	while (pent < plim) {
@@ -1076,15 +1076,15 @@ static void formalize_posix_acl(char *xv
 		case ACL_GROUP_OBJ:
 		case ACL_MASK:
 		case ACL_OTHER:
-			jent_s = (jffs2_acl_entry_short *)(buffer + offset);
-			offset += sizeof(jffs2_acl_entry_short);
+			jent_s = (struct jffs2_acl_entry_short *)(buffer + offset);
+			offset += sizeof(struct jffs2_acl_entry_short);
 			jent_s->e_tag = cpu_to_je16(le16_to_cpu(pent->e_tag));
 			jent_s->e_perm = cpu_to_je16(le16_to_cpu(pent->e_perm));
 			break;
 		case ACL_USER:
 		case ACL_GROUP:
-			jent = (jffs2_acl_entry *)(buffer + offset);
-			offset += sizeof(jffs2_acl_entry);
+			jent = (struct jffs2_acl_entry *)(buffer + offset);
+			offset += sizeof(struct jffs2_acl_entry);
 			jent->e_tag = cpu_to_je16(le16_to_cpu(pent->e_tag));
 			jent->e_perm = cpu_to_je16(le16_to_cpu(pent->e_perm));
 			jent->e_id = cpu_to_je32(le32_to_cpu(pent->e_id));
#18 lore raw

Hi,

I'll push two patches into jffs2-xattr-2.6.git tree. The one of them is obvious. It fixes a typo in comments.

I want any comments for another one before commiting into tree.

There is a possibility that jffs2_setup_xattr_datum() returns -EEXIST, if a xattr_datum which has same xid and newer version number is already registered.

The pre-patched implementation ignores this error code and doesn't care. Theredore, total process of FS-mounting failed. This patch fixes this problem, When we found such a obsolete node, it will be dealt as a DIRTY_SPACE() and FS-mounting will be continued.

It works correctly, and I belive this solution is right.

Thanks,

The broken-out patches are available at here:
http://www.kaigai.gr.jp/index.php?FrontPage#vd16984
01. jffs2-xattr-v5.2-01-fix-duplicate-xdatum.patch
02. jffs2-xattr-v5.2-02-fix_obvious_typo.patch

fs/jffs2/summary.c +7 -1
index 5cde227..d7884e3 100644
@@ -508,8 +508,14 @@ static int jffs2_sum_process_sum_data(st
                                xd = jffs2_setup_xattr_datum(c, je32_to_cpu(spx->xid),
                                                                je32_to_cpu(spx->version));
                                if (IS_ERR(xd)) {
-                                       JFFS2_NOTICE("allocation of xattr_datum failed\n");
                                        jffs2_free_raw_node_ref(raw);
+                                       if (PTR_ERR(xd) == -EEXIST) {
+                                               /* a newer version of xd exists */
+                                               DIRTY_SPACE(je32_to_cpu(spx->totlen));
+                                               sp += JFFS2_SUMMARY_XATTR_SIZE;
+                                               break;
+                                       }
+                                       JFFS2_NOTICE("allocation of xattr_datum failed\n");
                                        kfree(summary);
                                        return PTR_ERR(xd);
                                }
Quoted 56 lines · KaiGai Kohei

Hi,

Some fixes and updates on the todo list are already pushed to git://git.infradead.org/jffs2-xattr-2.6.git .

The broken-out patches are available at here:
http://www.kaigai.gr.jp/index.php?FrontPage#vd169842

01. jffs2-xattr-v5.1-01-remove_typedef_kernel.patch
02. jffs2-xattr-v5.1-02-remove_typedef_utils.patch
03. jffs2-xattr-v5.1-03-append_README.Locking.patch
04. jffs2-xattr-v5.1-04-remove_ilist_from_ic.patch
05. jffs2-xattr-v5.1-05-update_xattr_gc.patch
06. jffs2-xattr-v5.1-06-add_list.h.patch
07. jffs2-xattr-v5.1-07-unify_file_header.patch
08. jffs2-xattr-v5.1-08-remove_senseless_comment.patch
09. jffs2-xattr-v5.1-09-remove__KERNEL__.patch
10. jffs2-xattr-v5.1-10-remove_pointer_cast.patch

I hope to merge the second patch (jffs2-xattr-v5.1-02-remove_typedef_utils.patch), because this patch is for mtd-utils.git, not jffs2-xattr-2.6.git.

P.S.
Thanks David for your introduction about git on infradead.org.

Quoted 29 lines · David Woodhouse
Quoted 16 lines · KaiGai Kohei

[Current TODO list]
* Fix the declaration of jffs2_acl_header and so on by using 'struct' instead of 'typedef' in kernel space.
- Fix the declaration of jffs2_acl_header and so on by using 'struct' instead of 'typedef' in user space header.
* Add documentation about xattr_sem into README.Locking.
* Call jffs2_garbage_collect_xattr_datum/ref() from gc.c directly instead of jffs2_garbage_collect_xattr()
- Use unidirection list beween inode_chache and xattr_ref, instead of list_head.
- Add '#include <linux/list.h>' into xattr.h.
- Unify each file header part with any jffs2 files.
- Remove a senseless comment. ("/* forward refence */")
- Remove unneccesary pointer casts.
- Remove unneccesary '#ifdef __KERNEL__' on acl.h

Quoted 2 lines

*: It has already prepared, but I've not publicated yet. -: It has not prepated yet. I should work from now.

That's an excellent summary; thanks. It does serve to show that we've mostly picked on cosmetic details so far though :)

If you have patches committed into a git tree, you should be able to just 'git-push ssh://git.infradead.org/home/git/jffs2-xattr-2.6.git' to make it available.

Signature · 1 line
KaiGai Kohei <[email protected]>
maintainer
#19 lore raw
Quoted 8 lines · KaiGai Kohei

The pre-patched implementation ignores this error code and doesn't care. Theredore, total process of FS-mounting failed. This patch fixes this problem, When we found such a obsolete node, it will be dealt as a DIRTY_SPACE() and FS-mounting will be continued.

It works correctly, and I belive this solution is right.

It does look correct to me. The patch seems to highlight some inconsistency of tabs vs. spaces in the indenting though.

When committing to the a git tree, please remember that if I pull from it and then Linux pulls from it, the 'subject' of your commit should be meaningful in that context. So it should mention 'JFFS2' at the very least.

That's probably not quite so important for your jffs2-xattr tree, since I think I'll probably import that as a _patch_ when we're ready, rather than just pulling the whole thing. But in general, it's a useful thing to remember for people committing to git trees and expecting me to pull from them.

Signature · 1 line
dwmw2
#20 lore raw

Hi, Thanks for yout comments.

Quoted 2 lines

It does look correct to me. The patch seems to highlight some inconsistency of tabs vs. spaces in the indenting though.

Sorry, it's translated by terminal emulator automatically. The patch keeps consistency of tabs in the indenting.

Quoted 4 lines

When committing to the a git tree, please remember that if I pull from it and then Linux pulls from it, the 'subject' of your commit should be meaningful in that context. So it should mention 'JFFS2' at the very least.

OK, I'll pay attention to attach 'JFFS2' to the subject. But nine of previous patches which have been already commited did not attach such a keyword. Is it necessary to update the subject of them ? (But I don't know how to operate for this. Hmm...)

Thanks,

Quoted 5 lines

That's probably not quite so important for your jffs2-xattr tree, since I think I'll probably import that as a _patch_ when we're ready, rather than just pulling the whole thing. But in general, it's a useful thing to remember for people committing to git trees and expecting me to pull from them.

Signature · 1 line
KaiGai Kohei <[email protected]>
#21 lore raw
Quoted 5 lines · KaiGai Kohei

OK, I'll pay attention to attach 'JFFS2' to the subject. But nine of previous patches which have been already commited did not attach such a keyword. Is it necessary to update the subject of them ? (But I don't know how to operate for this. Hmm...)

Quite likely, the easiest way would be to work with two scripts. One to convert a git tree into a quilt series and another to convert the quilt series back into a git tree.

Advantage of quilt is the ease with which one can cherry-pick patches, change patches or descriptions, reorder patches, rebase them for a new kernel, etc.

I believe tglx (added to Cc:) has some scripts like that. And since many kernel hacker have similar needs, google should find even more.

[ Note to self: I need them as well. ]

Jörn

Signature · 2 lines
This above all: to thine own self be true.
-- Shakespeare
maintainer
#22 lore raw
In reply to KaiGai Kohei
Quoted 2 lines · KaiGai Kohei

Sorry, it's translated by terminal emulator automatically. The patch keeps consistency of tabs in the indenting.

OK, that's good.

Quoted 4 lines

OK, I'll pay attention to attach 'JFFS2' to the subject. But nine of previous patches which have been already commited did not attach such a keyword. Is it necessary to update the subject of them ? (But I don't know how to operate for this. Hmm...)

It is possible, I think -- the 'cg-admin-rewritehist' tool in Cogito allows it. Alternatively, it's easy enough to cherry-pick patches from git and apply them to a new branch, then make that new branch your 'master'. If you do this, remember to push with the '--force' option so that your new tree overwrites the remote.

If you like, we can leave the XATTR tree as it is, and import it as a patch instead of with git-pull. Then the history doesn't matter.

Signature · 1 line
dwmw2
#23 lore raw

Hi,

I have fixed the subject of patches in jffs2-xattr-2.6.git tree by the following method.

Quoted 4 lines

Alternatively, it's easy enough to cherry-pick patches from git and apply them to a new branch, then make that new branch your 'master'. If you do this, remember to push with the '--force' option so that your new tree overwrites the remote.

The all of previous 12 patches has '[JFFS2][XATTR]' prefix now. Please confirm at http://git.infradead.org/?p=jffs2-xattr-2.6.git;a=log

Thanks for those indications at early phase.

Signature · 1 line
KaiGai Kohei <[email protected]>
#25 lore raw
In reply to David Woodhouse
Quoted 17 lines · David Woodhouse
Quoted 16 lines · KaiGai Kohei

[Current TODO list]
* Fix the declaration of jffs2_acl_header and so on by using 'struct' instead of 'typedef' in kernel space.
- Fix the declaration of jffs2_acl_header and so on by using 'struct' instead of 'typedef' in user space header.
* Add documentation about xattr_sem into README.Locking.
* Call jffs2_garbage_collect_xattr_datum/ref() from gc.c directly instead of jffs2_garbage_collect_xattr()
- Use unidirection list beween inode_chache and xattr_ref, instead of list_head.
- Add '#include <linux/list.h>' into xattr.h.
- Unify each file header part with any jffs2 files.
- Remove a senseless comment. ("/* forward refence */")
- Remove unneccesary pointer casts.
- Remove unneccesary '#ifdef __KERNEL__' on acl.h

Quoted 5 lines
Quoted 2 lines

*: It has already prepared, but I've not publicated yet. -: It has not prepated yet. I should work from now.

That's an excellent summary; thanks. It does serve to show that we've mostly picked on cosmetic details so far though :)

Correct. The basic design makes sense, the code is good. I don't feel opposed to merging it once above list is handled. The number of new #ifdefs still concerns me a bit, but we can still deal with that after the merge. There has been worse.

Jörn

Signature · 4 lines
You can't tell where a program is going to spend its time. Bottlenecks
occur in surprising places, so don't try to second guess and put in a
speed hack until you've proven that's where the bottleneck is.
-- Rob Pike
#26 lore raw
In reply to KaiGai Kohei
Quoted 5 lines · KaiGai Kohei

This attached patches provide xattr support including POSIX-ACL and SELinux support on JFFS2 (version.5).
We can apply those patches to the latest git-tree.
- xattr_on_jffs2.kernel.version-5.patch can be applied to mtd-2.6.git.
- xattr_on_jffs2.utils.version-5.patch can be applied to mtd-utils.git.

The patch in general looks nice. I have got no real suggestions/objections for now, slowly trying to read it and delve into (the patch is quite large, my time is very limited).

Few suggestions for now (again cosmetic):

1. GC-related functions and summary-related functions should be moved to gc.c and summary.c
2. JFFS2 uses namings we all are used to. E.g., c - JFFS2 superblock structure, ref - struct jffs2_node_ref. I've noticed you use 'ref' as jffs2_xattr_ref pointers which is just a bit confusing. I would suggest you calling them 'xref' - this would improve readability a bit.

Example of confusing code:

fs/jffs2/xattr.c line 649

Quoted 4 lines
fs/jffs2/xattr.c +4 -0
+	down_write(&c->xattr_sem);
+	list_for_each_entry_safe(ref, _ref, &ic->ilist, ilist)
+		delete_xattr_ref(c, ref);
+	up_write(&c->xattr_sem);

This would be more readable for those aware with "older" JFFS2 internals:

fs/jffs2/xattr.c line 649

Quoted 4 lines
fs/jffs2/xattr.c +4 -0
+	down_write(&c->xattr_sem);
+	list_for_each_entry_safe(xref, _xref, &ic->ilist, ilist)
+		delete_xattr_ref(c, xref);
+	up_write(&c->xattr_sem);

It's minor, but still.

Will you object if I just do some changes I consider useful in xattr GIT? Or should I first mail you?

Signature · 3 lines
Best Regards,
Artem B. Bityutskiy,
St.-Petersburg, Russia.
maintainer
#27 lore raw
Quoted 4 lines · Artem B. Bityutskiy

Few suggestions for now (again cosmetic):

1. GC-related functions and summary-related functions should be moved to gc.c and summary.c

Then they'd need ifdefs. I'd prefer to keep them where they are, in separate files which aren't compiled if the XATTR options are disabled.

Quoted 4 lines

2. JFFS2 uses namings we all are used to. E.g., c - JFFS2 superblock structure, ref - struct jffs2_node_ref. I've noticed you use 'ref' as jffs2_xattr_ref pointers which is just a bit confusing. I would suggest you calling them 'xref' - this would improve readability a bit.

Really, I don't think it matters.

Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+		delete_xattr_ref(c, ref);
+		delete_xattr_ref(c, xref);

It's minor, but still.

It's not even 'minor'. It's total bullshit. If you can't look at the function name "delete_XATTR_REF" and work out what 'ref' is in that context, then you really shouldn't be trying to read the code. Life is hard; let's go shopping.

I got annoyed with you when you started on stuff like this in JFFS2 code. Don't start on the XATTR code too.

I do see your point to a _certain_ extent, but let's concentrate on things that actually matter instead, OK?

Quoted 2 lines

Will you object if I just do some changes I consider useful in xattr GIT? Or should I first mail you?

Feel free to make your own tree in ~dedekind/public_git and _ask_ people to pull from it. Please do not commit directly
to /home/git/jffs2-xattr-2.6 (not that I think you can anyway).

Signature · 1 line
dwmw2
#28 lore raw
Quoted 4 lines · David Woodhouse

It's not even 'minor'. It's total bullshit. If you can't look at the function name "delete_XATTR_REF" and work out what 'ref' is in that context, then you really shouldn't be trying to read the code. Life is hard; let's go shopping.

It's not bullshit. The name of function has nothing to do here - there are many places like that (1), the function name does not have to correlate (2).

Quoted 2 lines

I got annoyed with you when you started on stuff like this in JFFS2 code. Don't start on the XATTR code too.

I remember - you prevented me from many clean-ups and tidy-ups.

Quoted 2 lines

I do see your point to a _certain_ extent, but let's concentrate on things that actually matter instead, OK?

I also see your point. Sorry, but I do not agree with this strategy. Many things which "don't matter" may start mattering sooner or later.

Thanks.

#29 lore raw
In reply to David Woodhouse

Hi,

Quoted 7 lines
Quoted 4 lines

Few suggestions for now (again cosmetic):

1. GC-related functions and summary-related functions should be moved to gc.c and summary.c

Then they'd need ifdefs. I'd prefer to keep them where they are, in separate files which aren't compiled if the XATTR options are disabled.

I also agree David's opinion.

In addition, those functions are deployed enough locally-separating in xattr.c.
Sorry, I could not understand your dissatisfaction.

Quoted 12 lines
Quoted 4 lines

2. JFFS2 uses namings we all are used to. E.g., c - JFFS2 superblock structure, ref - struct jffs2_node_ref. I've noticed you use 'ref' as jffs2_xattr_ref pointers which is just a bit confusing. I would suggest you calling them 'xref' - this would improve readability a bit.

Really, I don't think it matters.

Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+		delete_xattr_ref(c, ref);
+		delete_xattr_ref(c, xref);

It's minor, but still.

Quoted 4 lines

It's not even 'minor'. It's total bullshit. If you can't look at the function name "delete_XATTR_REF" and work out what 'ref' is in that context, then you really shouldn't be trying to read the code. Life is hard; let's go shopping.

Is the 'raw' used as the common name for jffs2_raw_node_ref, not 'ref', isn't it? Because I thought those are not confusable, I adopted 'ref' as a name of jffs2_xattr_ref.

If we can arrive an agreement that it's confusable naming scheme, I'll prepare to change the common name of jffs2_xattr_ref. Both naming schemes are acceptable for me.

It's important to decide what should be decided at first, I think.

Thanks,

Signature · 2 lines
Open Source Software Promotion Center, NEC
KaiGai Kohei <[email protected]>