From: Chris Mason <mason@suse.com>
To: Erik Mouw <J.A.K.Mouw@ITS.TUDelft.NL>
Cc: Linux kernel mailing list <linux-kernel@vger.kernel.org>,
Nick Pasich <npasich@crash.cts.com>,
reiserfs-list@namesys.com
Subject: [PATCH] Re: reiserfs: still problems with tail conversion
Date: Sun, 25 Feb 2001 21:40:44 -0500 [thread overview]
Message-ID: <1136530000.983155244@tiny> (raw)
In-Reply-To: <20010225183201.D866@arthur.ubicom.tudelft.nl>
Hi guys,
This patch should take care of the other cause for null bytes
in small files. It has been through a few hours of testing,
with some of the usual load programs + Erik's code concurrently.
I'll let things run overnight to try and find more bugs. The
patch is against 2.4.2, and does a few things:
don't dirty the direct->indirect target until all direct items
have been copied in. Before it was dirtied for each direct item.
make the target up to date before dirtying (it was done after).
don't try to zero the unused part of the target until all bytes
have been copied. This was the big bug, it was zeroing previously
copied bytes.
Any testing on non-production machines would be appreciated,
I'll forward to Linus/Alan once I've gotten more feedback.
-chris
diff -ur diff/linux/fs/reiserfs/inode.c linux/fs/reiserfs/inode.c
--- diff/linux/fs/reiserfs/inode.c Tue Jan 16 14:14:22 2001
+++ linux/fs/reiserfs/inode.c Sun Feb 25 16:25:31 2001
@@ -771,6 +771,7 @@
** flush unbh before the transaction commits
*/
reiserfs_add_page_to_flush_list(&th, inode, unbh) ;
+ mark_buffer_dirty(unbh) ;
//inode->i_blocks += inode->i_sb->s_blocksize / 512;
//mark_tail_converted (inode);
diff -ur diff/linux/fs/reiserfs/stree.c linux/fs/reiserfs/stree.c
--- diff/linux/fs/reiserfs/stree.c Mon Jan 15 18:31:19 2001
+++ linux/fs/reiserfs/stree.c Sun Feb 25 16:25:31 2001
@@ -1438,7 +1438,6 @@
if ( p_s_un_bh ) {
int off;
- int block_off ;
char *data ;
/* We are in direct2indirect conversion, so move tail contents
@@ -1452,7 +1451,8 @@
** the unformatted node, which might schedule, meaning we'd have to
** loop all the way back up to the start of the while loop.
**
- ** The unformatted node is prepared and logged after the do_balance.
+ ** The unformatted node must be dirtied later on. We can't be
+ ** sure here if the entire tail has been deleted yet.
**
** p_s_un_bh is from the page cache (all unformatted nodes are
** from the page cache) and might be a highmem page. So, we
@@ -1463,24 +1463,12 @@
data = page_address(p_s_un_bh->b_page) ;
off = ((le_ih_k_offset (&s_ih) - 1) & (PAGE_CACHE_SIZE - 1));
- block_off = off & (p_s_un_bh->b_size - 1) ;
memcpy(data + off,
B_I_PITEM(PATH_PLAST_BUFFER(p_s_path), &s_ih), n_ret_value);
-
- /* clear out the rest of the block past the end of the file. */
- if (block_off + n_ret_value < p_s_un_bh->b_size) {
- memset(data + off + n_ret_value, 0,
- p_s_un_bh->b_size - block_off - n_ret_value) ;
- }
}
/* Perform balancing after all resources have been collected at once. */
do_balance(&s_del_balance, NULL, NULL, M_DELETE);
-
- /* see comment above for why this is after the do_balance */
- if (p_s_un_bh) {
- mark_buffer_dirty(p_s_un_bh) ;
- }
/* Return deleted body length */
return n_ret_value;
diff -ur diff/linux/fs/reiserfs/tail_conversion.c linux/fs/reiserfs/tail_conversion.c
--- diff/linux/fs/reiserfs/tail_conversion.c Mon Feb 19 13:07:32 2001
+++ linux/fs/reiserfs/tail_conversion.c Sun Feb 25 19:42:54 2001
@@ -32,6 +32,7 @@
struct super_block * sb = inode->i_sb;
struct buffer_head *up_to_date_bh ;
struct item_head * p_le_ih = PATH_PITEM_HEAD (path);
+ unsigned long total_tail = 0 ;
struct cpu_key end_key; /* Key to search for the last byte of the
converted item. */
struct item_head ind_ih; /* new indirect item to be inserted or
@@ -121,10 +122,19 @@
n_retval = reiserfs_delete_item (th, path, &end_key, inode,
up_to_date_bh) ;
+ total_tail += n_retval ;
if (tail_size == n_retval)
// done: file does not have direct items anymore
break;
+ }
+ /* if we've copied bytes from disk into the page, we need to zero
+ ** out the unused part of the block (it was not up to date before)
+ ** the page is still kmapped (by whoever called reiserfs_get_block)
+ */
+ if (up_to_date_bh) {
+ unsigned pgoff = (tail_offset + total_tail - 1) & (PAGE_CACHE_SIZE - 1);
+ memset(page_address(unbh->b_page) + pgoff, 0, n_blk_size - total_tail) ;
}
inode->u.reiserfs_i.i_first_direct_byte = U32_MAX;
next prev parent reply other threads:[~2001-02-26 2:41 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-02-23 21:18 reiserfs: still problems with tail conversion Erik Mouw
2001-02-23 22:10 ` Chris Mason
2001-02-23 22:19 ` Erik Mouw
2001-02-24 2:52 ` Michal Gornisiewicz
2001-02-24 4:13 ` Meino Christian Cramer
2001-02-24 8:18 ` thunder7
2001-02-24 19:27 ` Ken Moffat
2001-02-24 20:53 ` Alan Cox
2001-02-25 0:41 ` Chris Mason
2001-02-25 4:21 ` Bernd Eckenfels
2001-02-25 5:41 ` Mike Galbraith
2001-02-25 13:53 ` Alan Cox
2001-02-25 16:37 ` Erik Mouw
2001-02-25 17:32 ` Erik Mouw
2001-02-26 2:40 ` Chris Mason [this message]
2001-02-26 11:07 ` [PATCH] " Erik Mouw
2001-02-26 15:37 ` Erik Mouw
2001-02-26 22:46 ` Ken Moffat
2001-02-25 20:32 ` Chris Mason
2001-02-24 0:34 ` Oliver Teuber
[not found] ` <01022318321302.01755@flash>
2001-02-24 8:40 ` John E. Adams
2001-02-24 15:45 ` Arjan Filius
2001-02-24 16:24 ` [lkml]Re: " thunder7
2001-02-24 17:28 ` Chris Mason
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=1136530000.983155244@tiny \
--to=mason@suse.com \
--cc=J.A.K.Mouw@ITS.TUDelft.NL \
--cc=linux-kernel@vger.kernel.org \
--cc=npasich@crash.cts.com \
--cc=reiserfs-list@namesys.com \
/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