linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel J Blueman <daniel.blueman@gmail.com>
To: Chris Mason <chris.mason@oracle.com>
Cc: Linux BTRFS <linux-btrfs@vger.kernel.org>
Subject: [2.6.35-rc6 patch] correct item insert accounting...
Date: Fri, 23 Jul 2010 23:46:45 +0100	[thread overview]
Message-ID: <AANLkTinZo_nM2RZGPuNJD=jdLRqHEfVV76ra3tSDFBT1@mail.gmail.com> (raw)

Hi Chris,

It looks like this was the intent - if not, perhaps drop the redundant
'nr = i' assignment?

---

Limit the number of items to insert (nr) to the available space in the BTRFS
leaf as intended.

Signed-off-by: Daniel J Blueman <daniel.blueman@gmail.com>

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index c3df14c..fb7e20d 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -3544,8 +3544,8 @@ int btrfs_insert_some_items(struct
btrfs_trans_handle *trans,
 	for (i = 0; i < nr; i++) {
 		if (total_size + data_size[i] + sizeof(struct btrfs_item) >
 		    BTRFS_LEAF_DATA_SIZE(root)) {
-			break;
 			nr = i;
+			break;
 		}
 		total_data += data_size[i];
 		total_size += data_size[i] + sizeof(struct btrfs_item);
-- 
Daniel J Blueman

                 reply	other threads:[~2010-07-23 22:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='AANLkTinZo_nM2RZGPuNJD=jdLRqHEfVV76ra3tSDFBT1@mail.gmail.com' \
    --to=daniel.blueman@gmail.com \
    --cc=chris.mason@oracle.com \
    --cc=linux-btrfs@vger.kernel.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).