From: "Artem B. Bityuckiy" <abityuckiy@yandex.ru>
To: David Woodhouse <dwmw2@infradead.org>
Cc: linux-mtd@lists.infradead.org
Subject: Re: inode checkpoints
Date: Sat, 09 Oct 2004 18:48:30 +0400 [thread overview]
Message-ID: <4167FA3E.60609@yandex.ru> (raw)
In-Reply-To: <4167E11C.1020202@mail.ru>
> Moreover, there is the 'ofs' field in the jffs2_full_dnode which isn't
> really needed since the sabe information is in the raw->flash_offset
> field. So, we can for example add 'version' and remove 'ofs' field. The
> size won't change, the JFFS2 will be a bit simpler. Only small overhead
> (need to dereference pointer to get the ofs) will be introduced.
>
Sorry again (:-)), this is false. 'ofs' field is another offset and is
needed.
I was just confused by the comment "/* Don't really need this, but
optimisation */"...
Here is the patch (just for demonstration) to move the version field
from tmp_dnode_info to full_dnode structure. It is quite simple. But it
would be very useful fir checkpoints. It works at least with my simple
JFFS2 test.
--
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.
diff -auNr mtd-snapshot-20041008/fs/jffs2/nodelist.c
mtd-version-move/fs/jffs2/nodelist.c
--- mtd-snapshot-20041008/fs/jffs2/nodelist.c 2003-11-01
02:00:35.000000000 +0300
+++ mtd-version-move/fs/jffs2/nodelist.c 2004-10-09 17:50:43.325035342 +0400
@@ -62,7 +62,7 @@
{
struct jffs2_tmp_dnode_info **prev = list;
- while ((*prev) && (*prev)->version < tn->version) {
+ while ((*prev) && (*prev)->fn->version < tn->fn->version) {
prev = &((*prev)->next);
}
tn->next = (*prev);
@@ -363,7 +363,7 @@
jffs2_free_tmp_dnode_info(tn);
goto free_out;
}
- tn->version = je32_to_cpu(node.i.version);
+ tn->fn->version = je32_to_cpu(node.i.version);
tn->fn->ofs = je32_to_cpu(node.i.offset);
/* There was a bug where we wrote hole nodes out with
csize/dsize swapped. Deal with it */
diff -auNr mtd-snapshot-20041008/fs/jffs2/nodelist.h
mtd-version-move/fs/jffs2/nodelist.h
--- mtd-snapshot-20041008/fs/jffs2/nodelist.h 2004-10-08
02:00:14.000000000 +0400
+++ mtd-version-move/fs/jffs2/nodelist.h 2004-10-09 17:54:20.785755572 +0400
@@ -167,8 +167,8 @@
uint32_t size;
uint32_t frags; /* Number of fragments which currently refer
to this node. When this reaches zero,
- the node is obsolete.
- */
+ the node is obsolete. */
+ uint32_t version;
};
/*
@@ -180,7 +180,6 @@
{
struct jffs2_tmp_dnode_info *next;
struct jffs2_full_dnode *fn;
- uint32_t version;
};
struct jffs2_full_dirent
diff -auNr mtd-snapshot-20041008/fs/jffs2/readinode.c
mtd-version-move/fs/jffs2/readinode.c
--- mtd-snapshot-20041008/fs/jffs2/readinode.c 2003-11-04
02:00:36.000000000 +0300
+++ mtd-version-move/fs/jffs2/readinode.c 2004-10-09 17:48:25.354322429
+0400
@@ -526,7 +526,7 @@
fn = tn->fn;
if (f->metadata) {
- if (likely(tn->version >= mdata_ver)) {
+ if (likely(tn->fn->version >= mdata_ver)) {
D1(printk(KERN_DEBUG "Obsoleting old metadata at 0x%08x\n",
ref_offset(f->metadata->raw)));
jffs2_mark_node_obsolete(c, f->metadata->raw);
jffs2_free_full_dnode(f->metadata);
@@ -536,7 +536,7 @@
} else {
/* This should never happen. */
printk(KERN_WARNING "Er. New metadata at 0x%08x with ver %d is
actually older than previous ver %d at 0x%08x\n",
- ref_offset(fn->raw), tn->version, mdata_ver,
ref_offset(f->metadata->raw));
+ ref_offset(fn->raw), tn->fn->version, mdata_ver,
ref_offset(f->metadata->raw));
jffs2_mark_node_obsolete(c, fn->raw);
jffs2_free_full_dnode(fn);
/* Fill in latest_node from the metadata, not this one we're about
to free... */
@@ -549,9 +549,9 @@
jffs2_add_full_dnode_to_inode(c, f, fn);
} else {
/* Zero-sized node at end of version list. Just a metadata update */
- D1(printk(KERN_DEBUG "metadata @%08x: ver %d\n",
ref_offset(fn->raw), tn->version));
+ D1(printk(KERN_DEBUG "metadata @%08x: ver %d\n",
ref_offset(fn->raw), tn->fn->version));
f->metadata = fn;
- mdata_ver = tn->version;
+ mdata_ver = tn->fn->version;
}
next_tn:
tn_list = tn->next;
--
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.
next prev parent reply other threads:[~2004-10-09 14:49 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-04 10:14 inode checkpoints Artem Bityuckiy
2004-10-04 10:22 ` David Woodhouse
2004-10-04 10:36 ` [OBORONA-SPAM] " Artem B. Bityuckiy
2004-10-04 12:34 ` Josh Boyer
2004-10-04 13:07 ` Artem B. Bityuckiy
2004-10-04 13:18 ` David Woodhouse
2004-10-04 13:32 ` Artem B. Bityuckiy
2004-10-04 13:46 ` Artem B. Bityuckiy
2004-10-04 14:18 ` Artem B. Bityuckiy
2004-10-04 14:23 ` David Woodhouse
2004-10-04 15:07 ` Artem B. Bityuckiy
2004-10-05 14:07 ` Artem B. Bityuckiy
2004-10-05 16:45 ` David Woodhouse
2004-10-05 17:20 ` Josh Boyer
2004-10-06 9:07 ` Artem B. Bityuckiy
2004-10-09 11:45 ` Artem B. Bityuckiy
2004-10-09 11:58 ` Artem B. Bityuckiy
2004-10-09 13:01 ` Artem B. Bityuckiy
2004-10-09 14:48 ` Artem B. Bityuckiy [this message]
2004-10-09 13:22 ` Artem B. Bityuckiy
2004-10-04 11:44 ` Artem Bityuckiy
2004-10-04 12:36 ` Josh Boyer
2004-10-04 12:43 ` David Woodhouse
2004-10-04 13:26 ` [OBORONA-SPAM] " Artem B. Bityuckiy
2004-10-04 13:39 ` Josh Boyer
2004-10-04 13:56 ` Artem Bityuckiy
2004-10-04 14:06 ` Artem B. Bityuckiy
2004-10-04 14:17 ` Josh Boyer
2004-10-04 14:22 ` Artem B. Bityuckiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4167FA3E.60609@yandex.ru \
--to=abityuckiy@yandex.ru \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox