Skip to contentSkip to conversation

- git-nfsd-broke-reiser4.patch removed from -mm tree

PATCH In review [email protected] 3 participants 4 messages Oct 21, 2007 – Nov 28, 2007

lore
Share & tools
lore

[email protected]

author tree notice
#0 lore raw

The patch titled
git-nfsd-broke-reiser4
has been removed from the -mm tree. Its filename was
git-nfsd-broke-reiser4.patch

This patch was dropped because it was folded into reiser4.patch

------------------------------------------------------
Subject: git-nfsd-broke-reiser4
From: Andrew Morton <[email protected]>

fs/reiser4/export_ops.c: In function 'reiser4_decode_fh':
fs/reiser4/export_ops.c:96: error: 'const struct export_operations' has no member named 'find_exported_dentry' fs/reiser4/export_ops.c:96: warning: type defaults to 'int' in declaration of 'fn' fs/reiser4/export_ops.c:98: error: 'const struct export_operations' has no member named 'find_exported_dentry' fs/reiser4/export_ops.c:99: warning: comparison between pointer and integer fs/reiser4/export_ops.c:101: error: called object 'fn' is not a function fs/reiser4/export_ops.c: At top level:
fs/reiser4/export_ops.c:282: error: unknown field 'decode_fh' specified in initializer fs/reiser4/export_ops.c:282: warning: initialization from incompatible pointer type fs/reiser4/export_ops.c:284: error: unknown field 'get_dentry' specified in initializer fs/reiser4/export_ops.c:285: warning: excess elements in struct initializer fs/reiser4/export_ops.c:285: warning: (near initialization for 'reiser4_export_operations')

help!

Cc J. Bruce Fields <[email protected]>
Cc Edward Shishkin <[email protected]>
Cc "Vladimir V. Saveliev" <[email protected]>

---

 fs/reiser4/export_ops.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
fs/reiser4/export_ops.c renamed from fs/reiser4/export_ops.c~git-nfsd-broke-reiser4 +6 -4
diff -puN fs/reiser4/export_ops.c~git-nfsd-broke-reiser4 fs/reiser4/export_ops.c
@@ -86,7 +86,7 @@ static struct dentry *reiser4_decode_fh(
 
 	object_on_wire_init(&object);
 	object_on_wire_init(&parent);
-
+#if 0
 	addr = decode_inode(super, addr, &object);
 	if (!IS_ERR(addr)) {
 		if (with_parent)
@@ -105,12 +105,14 @@ static struct dentry *reiser4_decode_fh(
 			addr = (char *)d;
 		}
 	}
-
 	object_on_wire_done(&object);
 	object_on_wire_done(&parent);
 
 	reiser4_exit_context(ctx);
 	return (void *)addr;
+#else
+	return ERR_PTR(-EINVAL);
+#endif
 }
 
 /*
@@ -279,9 +281,9 @@ static struct dentry *reiser4_get_dentry
 
 struct export_operations reiser4_export_operations = {
 	.encode_fh = reiser4_encode_fh,
-	.decode_fh = reiser4_decode_fh,
+//	.decode_fh = reiser4_decode_fh,
 	.get_parent = reiser4_get_dentry_parent,
-	.get_dentry = reiser4_get_dentry
+//	.get_dentry = reiser4_get_dentry
 };
 
 /*

_

Patches currently in -mm which might be from [email protected] are

origin.patch memory-hotplug-make-kmem_cache_node-for-slub-on-memory-online-avoid-panic.patch capabilities-clean-up-file-capability-reading.patch ext2-avoid-rec_len-overflow-with-64kb-block-size.patch intel-iommu-pci-generic-helper-function.patch intel-iommu-iova-allocation-and-management-routines.patch intel-iommu-intel-iommu-driver.patch
intel-iommu-iommu-floppy-workaround.patch
kexec-add-bss-to-resource-tree.patch
acpi-add-reboot-mechanism.patch
git-alsa.patch
working-3d-dri-intel-agpko-resume-for-i815-chip.patch first-stab-at-elantech-touchpad-driver-for-26226-testers.patch
git-kvm.patch
git-libata-all.patch
drivers-ata-libata-ehc-fix-printk-warning.patch
ide-arm-hack.patch
nf_ct_alloc_hashtable-use-__gfp_nowarn.patch ucc_geth-fix-build-break-introduced-by-commit-09f75cd7bf13720738e6a196cc0107ce9a5bd5a0-checkpatch-fixes.patch update-smc91x-driver-with-arm-versatile-board-info.patch
git-nfsd-fixup.patch
fix-build-breakage-if-sysfs-fix.patch
git-scsi-misc.patch
git-unionfs.patch
security-convert-lsm-into-a-static-interface-fix-unionfs.patch slab-api-remove-useless-ctor-parameter-and-reorder-parameters-vs-unionfs.patch git-wireless.patch
git-wireless-fixup.patch
git-x86.patch
fix-x86_64-mm-sched-clock-share.patch vmscan-give-referenced-active-and-unmapped-pages-a-second-trip-around-the-lru.patch vm-dont-run-touch_buffer-during-buffercache-lookups.patch pm-qos-infrastructure-and-interface-fix.patch pm-qos-infrastructure-and-interface-vs-git-acpi.patch pm-qos-infrastructure-and-interface-vs-git-acpi-2.patch pm-qos-infrastructure-and-interface-static-initialization-with-blocking-notifiers-checkpatch-fixes.patch deprecate-smbfs-in-favour-of-cifs.patch
procfs-detect-duplicate-names.patch kernel-printkc-concerns-about-the-console-handover.patch sync_sb_inodes-propagate-errors.patch
peterz-vs-ext4-mballoc-core.patch
64-bit-i_version-afs-fixes.patch r-o-bind-mounts-elevate-write-count-during-entire-ncp_ioctl-fix.patch slab-api-remove-useless-ctor-parameter-and-reorder-parameters-vs-revoke.patch revoke-wire-up-i386-system-calls.patch
revoke-vs-git-block.patch
memory-controller-memory-accounting-v7-fix.patch memory-controller-add-per-container-lru-and-reclaim-v7-fix.patch memory-controller-oom-handling-v7-vs-oom-killer-stuff.patch memory-controller-add-switch-to-control-what-type-of-pages-to-limit-v7-fix-2.patch memcontrol-move-oom-task-exclusion-to-tasklist-fix.patch ftd_sio-clean-ups-and-updates-for-new-termios-work-checkpatch-fixes.patch drivers-edac-add-marvell-mv64x60-driver-fix.patch make-copy_from_user_inatomic-not-zero-the-tail-on-i386-vs-reiser4.patch
reiser4.patch
git-nfsd-broke-reiser4.patch slab-api-remove-useless-ctor-parameter-and-reorder-parameters-vs-reiser4.patch page-owner-tracking-leak-detector.patch
nr_blockdev_pages-in_interrupt-warning.patch
slab-leaks3-default-y.patch
profile-likely-unlikely-macros-fix.patch
put_bh-debug.patch
kmap_atomic-debugging.patch
shrink_slab-handle-bad-shrinkers.patch
getblk-handle-2tb-devices.patch
w1-build-fix.patch

#1 lore raw

PATCH 2/2 reiser4: new export ops

Quoted 24 lines · [email protected] wrote:

The patch titled
git-nfsd-broke-reiser4
has been removed from the -mm tree. Its filename was
git-nfsd-broke-reiser4.patch

This patch was dropped because it was folded into reiser4.patch

------------------------------------------------------
Subject: git-nfsd-broke-reiser4
From: Andrew Morton <[email protected]>

fs/reiser4/export_ops.c: In function 'reiser4_decode_fh':
fs/reiser4/export_ops.c:96: error: 'const struct export_operations' has no member named 'find_exported_dentry' fs/reiser4/export_ops.c:96: warning: type defaults to 'int' in declaration of 'fn' fs/reiser4/export_ops.c:98: error: 'const struct export_operations' has no member named 'find_exported_dentry' fs/reiser4/export_ops.c:99: warning: comparison between pointer and integer fs/reiser4/export_ops.c:101: error: called object 'fn' is not a function fs/reiser4/export_ops.c: At top level:
fs/reiser4/export_ops.c:282: error: unknown field 'decode_fh' specified in initializer fs/reiser4/export_ops.c:282: warning: initialization from incompatible pointer type fs/reiser4/export_ops.c:284: error: unknown field 'get_dentry' specified in initializer fs/reiser4/export_ops.c:285: warning: excess elements in struct initializer fs/reiser4/export_ops.c:285: warning: (near initialization for 'reiser4_export_operations')

Quoted 2 lines

help!

done

Thanks,
Edward.

Adjust reiser4 for the new export ops.

---
 linux-2.6.23-mm1/fs/reiser4/dscale.c                    |   20 ++++
 linux-2.6.23-mm1/fs/reiser4/dscale.h                    |    3 
 linux-2.6.23-mm1/fs/reiser4/export_ops.c                |   72 ++++++++--------
 linux-2.6.23-mm1/fs/reiser4/kassign.c                   |   19 +++-
 linux-2.6.23-mm1/fs/reiser4/kassign.h                   |    1 
 linux-2.6.23-mm1/fs/reiser4/plugin/file_plugin_common.c |    2 
 6 files changed, 78 insertions(+), 39 deletions(-)
fs/reiser4/export_ops.c renamed from fs/reiser4/export_ops.c.orig +37 -35
@@ -29,7 +29,8 @@
 
 /*
  * read serialized object identity from @addr and store information about
- * object in @obj. This is dual to encode_inode().
+ * object in @obj. If @obj == NULL, then don't read, just skip the encoded
+ * object (only return updated position).
  */
 static char *decode_inode(struct super_block *s, char *addr,
 			  reiser4_object_on_wire * obj)
@@ -41,7 +42,8 @@
 	fplug = file_plugin_by_disk_id(reiser4_get_tree(s), (d16 *) addr);
 	if (fplug != NULL) {
 		addr += sizeof(d16);
-		obj->plugin = fplug;
+		if (obj)
+			obj->plugin = fplug;
 		assert("nikita-3520", fplug->wire.read != NULL);
 		/* plugin specific encoding of object identity. */
 		addr = fplug->wire.read(addr, obj);
@@ -50,28 +52,23 @@
 	return addr;
 }
 
+static struct dentry *reiser4_get_dentry(struct super_block *super,
+					 void *data);
 /**
- * reiser4_decode_fh - decode_fh of export operations
- * @super: super block
- * @fh: nfsd file handle
- * @len: length of file handle
- * @fhtype: type of file handle
- * @acceptable: acceptability testing function
- * @context: argument for @acceptable
+ * reiser4_decode_fh: decode onwire object - helper function
+ * for fh_to_dentry, fh_to_parent export operations;
+ * @super: super block;
+ * @fh: here are onwire objects to be extracted for decoding;
+ * @parent: skip first onwire object and decode parent.
  *
- * Returns dentry referring to the same file as @fh.
+ * Returns dentry referring to the object being decoded.
  */
 static struct dentry *reiser4_decode_fh(struct super_block *super, __u32 *fh,
-					int len, int fhtype,
-					int (*acceptable) (void *context,
-							   struct dentry *de),
-					void *context)
+					int len, int fhtype, int parent)
 {
 	reiser4_context *ctx;
 	reiser4_object_on_wire object;
-	reiser4_object_on_wire parent;
 	char *addr;
-	int with_parent;
 
 	ctx = reiser4_init_context(super);
 	if (IS_ERR(ctx))
@@ -80,25 +77,19 @@
 	assert("vs-1482",
 	       fhtype == FH_WITH_PARENT || fhtype == FH_WITHOUT_PARENT);
 
-	with_parent = (fhtype == FH_WITH_PARENT);
-
 	addr = (char *)fh;
 
 	object_on_wire_init(&object);
-	object_on_wire_init(&parent);
-#if 0
-	addr = decode_inode(super, addr, &object);
+
+	if (parent)
+		/* skip first onwire object */
+		addr = decode_inode(super, addr, NULL);
 	if (!IS_ERR(addr)) {
-		if (with_parent)
-			addr = decode_inode(super, addr, &parent);
+		addr = decode_inode(super, addr, &object);
 		if (!IS_ERR(addr)) {
 			struct dentry *d;
-			typeof(super->s_export_op->find_exported_dentry) fn;
 
-			fn = super->s_export_op->find_exported_dentry;
-			assert("nikita-3521", fn != NULL);
-			d = fn(super, &object, with_parent ? &parent : NULL,
-			       acceptable, context);
+			d = reiser4_get_dentry(super, &object);
 			if (d != NULL && !IS_ERR(d))
 				/* FIXME check for -ENOMEM */
 			  	reiser4_get_dentry_fsdata(d)->stateless = 1;
@@ -106,13 +97,24 @@
 		}
 	}
 	object_on_wire_done(&object);
-	object_on_wire_done(&parent);
-
 	reiser4_exit_context(ctx);
 	return (void *)addr;
-#else
-	return ERR_PTR(-EINVAL);
-#endif
+}
+
+static struct dentry *reiser4_fh_to_dentry(struct super_block *sb,
+					   struct fid *fid,
+					   int fh_len, int fh_type)
+{
+	return reiser4_decode_fh(sb, fid->raw, fh_len, fh_type, 0);
+}
+
+static struct dentry *reiser4_fh_to_parent(struct super_block *sb,
+					   struct fid *fid,
+					   int fh_len, int fh_type)
+{
+	if (fh_type == FH_WITHOUT_PARENT)
+		return NULL;
+	return reiser4_decode_fh(sb, fid->raw, fh_len, fh_type, 1);
 }
 
 /*
@@ -281,9 +283,9 @@
 
 struct export_operations reiser4_export_operations = {
 	.encode_fh = reiser4_encode_fh,
-//	.decode_fh = reiser4_decode_fh,
+	.fh_to_dentry = reiser4_fh_to_dentry,
+	.fh_to_parent = reiser4_fh_to_parent,
 	.get_parent = reiser4_get_dentry_parent,
-//	.get_dentry = reiser4_get_dentry
 };
 
 /*
fs/reiser4/dscale.c renamed from fs/reiser4/dscale.c.orig +19 -1
@@ -126,6 +126,24 @@
 	return 1 << tag;
 }
 
+/* number of bytes consumed */
+int dscale_bytes_to_read(unsigned char *address)
+{
+	int tag;
+
+	tag = gettag(address);
+	switch (tag) {
+	case 0:
+	case 1:
+	case 2:
+		return 1 << tag;
+	case 3:
+		return 9;
+	default:
+		return RETERR(-EIO);
+	}
+}
+
 /* store @value at @address and return number of bytes consumed */
 int dscale_write(unsigned char *address, __u64 value)
 {
@@ -144,7 +162,7 @@
 }
 
 /* number of bytes required to store @value */
-int dscale_bytes(__u64 value)
+int dscale_bytes_to_write(__u64 value)
 {
 	int bytes;
 
fs/reiser4/dscale.h renamed from fs/reiser4/dscale.h.orig +2 -1
@@ -10,7 +10,8 @@
 
 extern int dscale_read(unsigned char *address, __u64 * value);
 extern int dscale_write(unsigned char *address, __u64 value);
-extern int dscale_bytes(__u64 value);
+extern int dscale_bytes_to_read(unsigned char *address);
+extern int dscale_bytes_to_write(__u64 value);
 extern int dscale_fit(__u64 value, __u64 other);
 
 /* __FS_REISER4_DSCALE_H__ */
fs/reiser4/kassign.c renamed from fs/reiser4/kassign.c.orig +17 -2
@@ -604,8 +604,8 @@
 {
 	int result;
 
-	result = dscale_bytes(get_inode_oid(inode));
-	result += dscale_bytes(get_inode_locality(inode));
+	result = dscale_bytes_to_write(get_inode_oid(inode));
+	result += dscale_bytes_to_write(get_inode_locality(inode));
 
 	/*
 	 * ordering is large (it usually has highest bits set), so it makes
@@ -650,6 +650,21 @@
 	return addr;
 }
 
+/*
+ * skip a key that was previously encoded by build_inode_onwire() at @addr
+ */
+char * locate_obj_key_id_onwire(char * addr)
+{
+	/* locality */
+	addr += dscale_bytes_to_read(addr);
+	/* objectid */
+	addr += dscale_bytes_to_read(addr);
+#if REISER4_LARGE_KEY
+	addr += sizeof ((obj_key_id *)0)->ordering;
+#endif
+	return addr;
+}
+
 /* Make Linus happy.
    Local variables:
    c-indentation-style: "K&R"
fs/reiser4/kassign.h renamed from fs/reiser4/kassign.h.orig +1 -0
@@ -64,6 +64,7 @@
 
 extern int inode_onwire_size(const struct inode *obj);
 extern char *build_inode_onwire(const struct inode *obj, char *area);
+extern char *locate_obj_key_id_onwire(char *area);
 extern char *extract_obj_key_id_from_onwire(char *area, obj_key_id * key_id);
 
 extern int build_inode_key_id(const struct inode *obj, obj_key_id * id);
fs/reiser4/plugin/file_plugin_common.c renamed from fs/reiser4/plugin/file_plugin_common.c.orig +2 -0
@@ -459,6 +459,8 @@
 
 char *wire_read_common(char *addr, reiser4_object_on_wire * obj)
 {
+	if (!obj)
+		return locate_obj_key_id_onwire(addr);
 	return extract_obj_key_id_from_onwire(addr, &obj->u.std.key_id);
 }
 
#2 lore raw

Re: [patch 2/2] reiser4: new export ops

This code looks a little confusing to me..

fs/reiser4/export_ops.c line 46

Quoted 10 lines

*/
static char *decode_inode(struct super_block *s, char *addr,

fs/reiser4/export_ops.c renamed from fs/reiser4/export_ops.c.orig +2 -1
 			  reiser4_object_on_wire * obj)
@@ -41,7 +42,8 @@
 	fplug = file_plugin_by_disk_id(reiser4_get_tree(s), (d16 *) addr);
 	if (fplug != NULL) {
 		addr += sizeof(d16);
-		obj->plugin = fplug;
+		if (obj)
+			obj->plugin = fplug;

You are adding quite a few of those if (obj) clauses. I can't see a reason for that - care to explain? The new aops should not disallow for any functionality that has been there before.

Quoted 16 lines
fs/reiser4/export_ops.c renamed from fs/reiser4/export_ops.c.orig +1 -0
 static struct dentry *reiser4_decode_fh(struct super_block *super, __u32 *fh,
+					int len, int fhtype, int parent)
 {
 	reiser4_context *ctx;
 	reiser4_object_on_wire object;
 	char *addr;
 
 	ctx = reiser4_init_context(super);
 	if (IS_ERR(ctx))
@@ -80,25 +77,19 @@
 	assert("vs-1482",
 	       fhtype == FH_WITH_PARENT || fhtype == FH_WITHOUT_PARENT);
 
 	addr = (char *)fh;
 
 	object_on_wire_init(&object);

fs/reiser4/export_ops.c line 92

Quoted 10 lines
fs/reiser4/export_ops.c renamed from fs/reiser4/export_ops.c.orig +6 -0
+
+	if (parent)
+		/* skip first onwire object */
+		addr = decode_inode(super, addr, NULL);
 	if (!IS_ERR(addr)) {
+		addr = decode_inode(super, addr, &object);
 		if (!IS_ERR(addr)) {
 			struct dentry *d;
 
+			d = reiser4_get_dentry(super, &object);

I'd suggest to directly poke into the place where the parent handle is stored. XFS used a similar construct to the decode_inode helper, but with the new aops it's faster and easier to read if you just have a helper on how many bytes to skip. Did you take a look at how the various other filesystem handle the export ops?

fs/reiser4/dscale.c

Quoted 3 lines
fs/reiser4/dscale.c renamed from fs/reiser4/dscale.c.orig +0 -0
@@ -126,6 +126,24 @@

How are the changes to all these other files related to the export operations changes?

#3 lore raw

Re: [patch 2/2] reiser4: new export ops

Quoted 4 lines · Christoph Hellwig

This code looks a little confusing to me..

Quoted 16 lines

Review line 48

Quoted 12 lines

*/
static char *decode_inode(struct super_block *s, char *addr,
reiser4_object_on_wire * obj)

(quoted diff) +2 -1
@@ -41,7 +42,8 @@
 	fplug = file_plugin_by_disk_id(reiser4_get_tree(s), (d16 *) addr);
 	if (fplug != NULL) {
 		addr += sizeof(d16);
-		obj->plugin = fplug;
+		if (obj)
+			obj->plugin = fplug;
 
 

You are adding quite a few of those if (obj) clauses. I can't see a reason for that - care to explain? The new aops

new _export_ ops

Quoted 5 lines

should not disallow for
any functionality that has been there before.

Actually they don't disallow existing functionality, but require a new one: earlier we performed decoding in _each_ iteration (decode_fh), and now you want it to be done separately (fh_to_dentry, fh_to_parent). So we need something like "empty" iteration, which only moves to the next position.

Every object in reiser4, that can be serialized, has special non-zero "wire" methods. I guess that "empty" iteration should be performed via wire->read() method which is responsible for extracting on-wire object. Can not promise to avoid "if" here: I think it is not a good reason to add a new plugin method for such empty skip.

The attached patch avoids other two ifs.

Quoted 25 lines
Quoted 25 lines
(quoted diff) +1 -0
 static struct dentry *reiser4_decode_fh(struct super_block *super, __u32 *fh,
+					int len, int fhtype, int parent)
{
	reiser4_context *ctx;
	reiser4_object_on_wire object;
	char *addr;

	ctx = reiser4_init_context(super);
	if (IS_ERR(ctx))
(quoted diff) +5 -0
@@ -80,25 +77,19 @@
 	assert("vs-1482",
 	       fhtype == FH_WITH_PARENT || fhtype == FH_WITHOUT_PARENT);
 
 	addr = (char *)fh;
 
 	object_on_wire_init(&object);
+
+	if (parent)
+		/* skip first onwire object */
+		addr = decode_inode(super, addr, NULL);
 	if (!IS_ERR(addr)) {
+		addr = decode_inode(super, addr, &object);
 		if (!IS_ERR(addr)) {
 			struct dentry *d;
 
Quoted 12 lines

Review line 94

Quoted 3 lines
(quoted diff) +1 -0
+			d = reiser4_get_dentry(super, &object);
 
 

I'd suggest to directly poke into the place where the parent handle is stored. XFS used a similar construct to the decode_inode helper, but with the new aops it's faster and easier to read if you just have a helper on how many bytes to skip. Did you take a look at how the various other filesystem handle the export ops?

We don't have a number of u32s to poke, like other filesystems do; packing/extracting serialized objects in reiser4 is more complex:
first extract object's plugin, which knows how to extract further, etc..

Quoted 11 lines

fs/reiser4/dscale.c line 127

Quoted 5 lines
fs/reiser4/dscale.c renamed from fs/reiser4/dscale.c.orig +0 -0
@@ -126,6 +126,24 @@
 
 

How are the changes to all these other files related to the export operations changes?

So we have to define an "if" branch for wire_read_common() (plugin/file_plugin_common.c). The best place to do it is kassign.c (as we actually pack/extract key components). Plus a small change in dscale.c where a packing taxonomy is implemented. Have I missed something?

Thanks,
Edward.

Adjust reiser4 to new export ops.

---
 linux-2.6.23-mm1/fs/reiser4/dscale.c                    |   20 ++
 linux-2.6.23-mm1/fs/reiser4/dscale.h                    |    3 
 linux-2.6.23-mm1/fs/reiser4/export_ops.c                |  128 +++++++++-------
 linux-2.6.23-mm1/fs/reiser4/kassign.c                   |   20 ++
 linux-2.6.23-mm1/fs/reiser4/kassign.h                   |    1 
 linux-2.6.23-mm1/fs/reiser4/plugin/file_plugin_common.c |    2 
 6 files changed, 117 insertions(+), 57 deletions(-)
fs/reiser4/dscale.c renamed from fs/reiser4/dscale.c.orig +19 -1
@@ -126,6 +126,24 @@
 	return 1 << tag;
 }
 
+/* number of bytes consumed */
+int dscale_bytes_to_read(unsigned char *address)
+{
+	int tag;
+
+	tag = gettag(address);
+	switch (tag) {
+	case 0:
+	case 1:
+	case 2:
+		return 1 << tag;
+	case 3:
+		return 9;
+	default:
+		return RETERR(-EIO);
+	}
+}
+
 /* store @value at @address and return number of bytes consumed */
 int dscale_write(unsigned char *address, __u64 value)
 {
@@ -144,7 +162,7 @@
 }
 
 /* number of bytes required to store @value */
-int dscale_bytes(__u64 value)
+int dscale_bytes_to_write(__u64 value)
 {
 	int bytes;
 
fs/reiser4/dscale.h renamed from fs/reiser4/dscale.h.orig +2 -1
@@ -10,7 +10,8 @@
 
 extern int dscale_read(unsigned char *address, __u64 * value);
 extern int dscale_write(unsigned char *address, __u64 value);
-extern int dscale_bytes(__u64 value);
+extern int dscale_bytes_to_read(unsigned char *address);
+extern int dscale_bytes_to_write(__u64 value);
 extern int dscale_fit(__u64 value, __u64 other);
 
 /* __FS_REISER4_DSCALE_H__ */
fs/reiser4/export_ops.c renamed from fs/reiser4/export_ops.c.orig +75 -53

153 lines not on this page · raw message

fs/reiser4/kassign.c renamed from fs/reiser4/kassign.c.orig +18 -2
@@ -604,8 +604,8 @@
 {
 	int result;
 
-	result = dscale_bytes(get_inode_oid(inode));
-	result += dscale_bytes(get_inode_locality(inode));
+	result = dscale_bytes_to_write(get_inode_oid(inode));
+	result += dscale_bytes_to_write(get_inode_locality(inode));
 
 	/*
 	 * ordering is large (it usually has highest bits set), so it makes
@@ -650,6 +650,22 @@
 	return addr;
 }
 
+/*
+ * skip a key that was previously encoded by build_inode_onwire() at @addr
+ * FIXME: handle IO errors.
+ */
+char * locate_obj_key_id_onwire(char * addr)
+{
+	/* locality */
+	addr += dscale_bytes_to_read(addr);
+	/* objectid */
+	addr += dscale_bytes_to_read(addr);
+#if REISER4_LARGE_KEY
+	addr += sizeof ((obj_key_id *)0)->ordering;
+#endif
+	return addr;
+}
+
 /* Make Linus happy.
    Local variables:
    c-indentation-style: "K&R"
fs/reiser4/kassign.h renamed from fs/reiser4/kassign.h.orig +1 -0
@@ -64,6 +64,7 @@
 
 extern int inode_onwire_size(const struct inode *obj);
 extern char *build_inode_onwire(const struct inode *obj, char *area);
+extern char *locate_obj_key_id_onwire(char *area);
 extern char *extract_obj_key_id_from_onwire(char *area, obj_key_id * key_id);
 
 extern int build_inode_key_id(const struct inode *obj, obj_key_id * id);
fs/reiser4/plugin/file_plugin_common.c renamed from fs/reiser4/plugin/file_plugin_common.c.orig +2 -0
@@ -459,6 +459,8 @@
 
 char *wire_read_common(char *addr, reiser4_object_on_wire * obj)
 {
+	if (!obj)
+		return locate_obj_key_id_onwire(addr);
 	return extract_obj_key_id_from_onwire(addr, &obj->u.std.key_id);
 }