From: Artem Bityutskiy <dedekind1@gmail.com>
To: Joel Reardon <joel@clambassador.com>
Cc: MTD Maling List <linux-mtd@lists.infradead.org>
Subject: [PATCH 4/4] UBIFS: add TOTOs for Joel
Date: Thu, 7 Jun 2012 12:06:08 +0300 [thread overview]
Message-ID: <1339059968-25753-4-git-send-email-dedekind1@gmail.com> (raw)
In-Reply-To: <1339059968-25753-1-git-send-email-dedekind1@gmail.com>
From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
---
fs/ubifs/sb.c | 17 +++++++++++++++++
fs/ubifs/ubifs.h | 6 ++++++
2 files changed, 23 insertions(+)
diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c
index 91c78e7..20eec40 100644
--- a/fs/ubifs/sb.c
+++ b/fs/ubifs/sb.c
@@ -73,6 +73,23 @@
*/
static int calc_ksa_lebs(struct ubifs_info *c, int leb_cnt)
{
+ /* TODO: I do not think this is correct. The data node size varies from
+ * UBIFS_DATA_NODE_SZ to UBIFS_MAX_DATA_NODE_SZ. Indeed, I can fill my
+ * file-system with millions of files with size of 1 byte. But you
+ * assume that data nodes are 4KiB in size, which is wrong. Remember
+ * that we compress the data? Or I misunderstoos something?
+ *
+ * Or even worse, if I have a huge file containing only 1's or anything
+ * else which perfectly well compresses, and I fill all space with this
+ * file, then we'll end up with huge amount of tiny data nodes, and
+ * you'll need one key per data node.
+ *
+ * So, the most pessimistic thing is to assume the minimum data node
+ * size of UBIFS_DATA_NODE_SZ, right? */
+
+ /* TODO: note, the leb_cnt * UBIFS_CRYPTO_KEYSIZE part may easily
+ * overflow because it will be done as 32-bit multiplication with a
+ * 32-bit result. So this is not really correct */
return (leb_cnt * UBIFS_CRYPTO_KEYSIZE) >> UBIFS_BLOCK_SHIFT;
}
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index f34ab84..2b43107 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -167,11 +167,17 @@
/*
* Constant number of KSA LEBS to add to computed value, ensuring two plus a
* checkpoint LEB.
+ *
+ * TODO: please, improve the comment to make it easier to understand why you
+ * need 3 extra LEBs. Also the checkpoint LEB is something new to me.
*/
#define UBIFS_KSA_ADD_LEBS 3
/*
* KSA LEBS is 1.125 * the computed min to allow unused keys when the drive is
* full. This shift is used to compute 0.125 * LEBS.
+ *
+ * TODO: looks like blach magic. Could the comment be improved to make this
+ * easy to understand why we need unused keys?
*/
#define UBIFS_KSA_LEBS_SCALE_SHIFT 3
--
1.7.10
next prev parent reply other threads:[~2012-06-07 9:04 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-25 13:10 [PATCH] UBIFS: compute KSA size and store in superblock Joel Reardon
2012-05-25 13:24 ` Artem Bityutskiy
2012-05-26 11:21 ` Joel Reardon
2012-05-26 13:31 ` Artem Bityutskiy
2012-05-30 13:32 ` [PATCH v2] " Joel Reardon
2012-05-30 15:18 ` Artem Bityutskiy
2012-05-31 10:12 ` Joel Reardon
2012-05-31 10:19 ` Artem Bityutskiy
2012-05-31 10:36 ` Artem Bityutskiy
2012-06-06 10:03 ` [PATCH v3] " Joel Reardon
2012-06-06 14:30 ` Artem Bityutskiy
2012-06-06 18:52 ` [PATCH v4] " Joel Reardon
2012-06-07 9:06 ` [PATCH 1/4] UBIFS: correction to Joels' patch Artem Bityutskiy
2012-06-07 9:06 ` [PATCH 2/4] UBIFS: another correction to joel's patch Artem Bityutskiy
2012-06-07 9:06 ` [PATCH 3/4] UBIFS: improvement to Joel's patch Artem Bityutskiy
2012-06-07 9:06 ` Artem Bityutskiy [this message]
2012-06-07 9:10 ` [PATCH v4] UBIFS: compute KSA size and store in superblock Artem Bityutskiy
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=1339059968-25753-4-git-send-email-dedekind1@gmail.com \
--to=dedekind1@gmail.com \
--cc=joel@clambassador.com \
--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;
as well as URLs for NNTP newsgroup(s).