From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Holger Kiehl <Holger.Kiehl@dwd.de>
Cc: Theodore Tso <tytso@mit.edu>, Eric Sandeen <sandeen@redhat.com>,
Jan Kara <jack@suse.cz>,
Solofo.Ramangalahy@bull.net, Nick Dokos <nicholas.dokos@hp.com>,
linux-ext4@vger.kernel.org,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Performance of ext4
Date: Mon, 23 Jun 2008 23:15:08 +0530 [thread overview]
Message-ID: <20080623174508.GA7216@skywalker> (raw)
In-Reply-To: <Pine.LNX.4.64.0806200905070.3383@diagnostix.dwd.de>
On Fri, Jun 20, 2008 at 09:21:48AM +0000, Holger Kiehl wrote:
> On Fri, 20 Jun 2008, Theodore Tso wrote:
>
>> On Fri, Jun 20, 2008 at 08:32:52AM +0000, Holger Kiehl wrote:
>>>> It sounds like i_size is actually dropping in
>>>> size at some pointer long after the file was written. If I had to
>>
>> sorry, "at some point"...
>>
>>>> guess the value in the inode cache is correct; and perhaps so is the
>>>> value on the journal. But somehow, the wrong value is getting written
>>>> to disk
>>
>> Or, "the right value is never getting written to disk". (Which as I
>> think about it is more likely; it's likely that an update to i_size is
>> getting *lost*, perhaps because the delalloc code is possibly
>> modifying i_size without starting a transaction first. Again this is
>> just a guess.)
>>
>>> What I find strange is that the missing parts of the file are not for
>>> example exactly 512 or 1024 or 4096 bytes it is mostly some odd number
>>> of bytes.
>>
>> Is there any chance the truncation point is related to how the program
>> is writing its output file? i.e., if it is a text file, is the
>> truncation happening after a new-line or when the stdio library might
>> have done an explicit or implicit fflush()?
>>
> When the benchmark runs it writes to stdout and with tee to the result
> file. It first writes some information about the system, prepares the
> test files (creates lots of small files), calls sync and then starts
> the test. Then every minute one line gets written to the result file.
> Often I have seen that everything after the sync was missing. But
> sometimes it happened that some parts at the end are missing. But it
> was always a clean cut, that is there where no lines that where cut
> partially. The lines where always complete.
>
I found one place where we fail to update i_disksize. Can you try this
patch ?
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 33f940b..9fa737f 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1620,7 +1620,10 @@ static int ext4_da_writepage(struct page *page,
loff_t size;
unsigned long len;
handle_t *handle = NULL;
+ ext4_lblk_t block;
+ loff_t disksize;
struct buffer_head *page_bufs;
+ struct buffer_head *bh, *head;
struct inode *inode = page->mapping->host;
handle = ext4_journal_current_handle();
@@ -1662,6 +1665,38 @@ static int ext4_da_writepage(struct page *page,
else
ret = block_write_full_page(page, ext4_da_get_block_write, wbc);
+ if (ret)
+ return ret;
+ /*
+ * When called via shrink_page_list and if we don't have any unmapped
+ * buffer_head we still could have written some new content in an
+ * already mapped buffer. That means we need to extent i_disksize here
+ */
+ /* Find the last logical block number in the page. */
+ block = (sector_t)page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits);
+ bh = head = page_buffers(page);
+ do {
+ bh = bh->b_this_page;
+ block++;
+ } while (bh != head);
+
+ disksize = ((loff_t) block) << inode->i_blkbits;
+ if (disksize > i_size_read(inode))
+ disksize = i_size_read(inode);
+ if (disksize > EXT4_I(inode)->i_disksize) {
+ /*
+ * XXX: replace with spinlock if seen contended -bzzz
+ */
+ down_write(&EXT4_I(inode)->i_data_sem);
+ if (disksize > EXT4_I(inode)->i_disksize)
+ EXT4_I(inode)->i_disksize = disksize;
+ up_write(&EXT4_I(inode)->i_data_sem);
+
+ if (EXT4_I(inode)->i_disksize == disksize) {
+ ret = ext4_mark_inode_dirty(handle, inode);
+ return ret;
+ }
+ }
return ret;
}
next prev parent reply other threads:[~2008-06-23 17:45 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-11 8:02 Performance of ext4 Holger Kiehl
2008-06-11 10:59 ` Aneesh Kumar K.V
2008-06-11 19:58 ` Holger Kiehl
2008-06-11 20:17 ` Nick Dokos
2008-06-12 9:02 ` Holger Kiehl
2008-06-12 10:58 ` Solofo.Ramangalahy
2008-06-12 12:00 ` Holger Kiehl
2008-06-12 13:19 ` Theodore Tso
2008-06-12 14:07 ` Holger Kiehl
2008-06-12 18:06 ` Aneesh Kumar K.V
2008-06-12 19:50 ` Holger Kiehl
2008-06-13 8:05 ` Holger Kiehl
2008-06-16 17:54 ` Jan Kara
2008-06-16 18:13 ` Aneesh Kumar K.V
2008-06-17 11:42 ` Holger Kiehl
2008-06-18 5:58 ` Holger Kiehl
2008-06-19 6:58 ` Andreas Dilger
2008-06-19 11:09 ` Theodore Tso
2008-06-19 15:04 ` Holger Kiehl
2008-07-07 13:13 ` Holger Kiehl
2008-07-10 8:11 ` Holger Kiehl
2008-07-10 9:24 ` Aneesh Kumar K.V
2008-07-10 9:26 ` Revert Fix-EXT_MAX_BLOCK.patch Aneesh Kumar K.V
2008-07-10 12:22 ` Theodore Tso
2008-07-10 12:38 ` Aneesh Kumar K.V
2008-07-10 13:02 ` Theodore Tso
2008-07-10 12:24 ` Theodore Tso
2008-07-11 9:57 ` Holger Kiehl
2008-07-11 12:43 ` Theodore Tso
2008-07-11 14:57 ` Holger Kiehl
2008-07-14 19:55 ` Holger Kiehl
2008-07-14 20:28 ` Theodore Tso
2008-07-15 6:43 ` Holger Kiehl
2008-06-19 15:56 ` Performance of ext4 Theodore Tso
2008-06-19 16:41 ` Eric Sandeen
2008-06-19 16:41 ` Eric Sandeen
2008-06-19 17:42 ` Theodore Tso
2008-06-19 19:51 ` Mingming
2008-06-20 8:32 ` Holger Kiehl
2008-06-20 8:59 ` Theodore Tso
2008-06-20 9:21 ` Holger Kiehl
2008-06-23 17:45 ` Aneesh Kumar K.V [this message]
2008-06-24 0:31 ` Mingming
2008-06-24 0:31 ` Mingming
2008-06-24 3:07 ` Aneesh Kumar K.V
2008-06-24 3:28 ` Aneesh Kumar K.V
2008-06-24 3:33 ` Aneesh Kumar K.V
2008-06-24 21:12 ` Holger Kiehl
2008-06-24 22:58 ` Mingming
2008-06-25 9:09 ` Holger Kiehl
2008-06-26 0:46 ` Mingming
2008-06-27 9:14 ` Aneesh Kumar K.V
2008-06-27 9:14 ` Aneesh Kumar K.V
2008-06-27 9:49 ` Aneesh Kumar K.V
2008-06-27 10:00 ` Jan Kara
2008-06-27 17:35 ` Aneesh Kumar K.V
2008-06-24 17:58 ` Mingming
2008-06-24 12:57 ` Holger Kiehl
2008-06-23 20:55 ` Andreas Dilger
2008-06-20 8:09 ` Holger Kiehl
2008-06-21 15:02 ` Holger Kiehl
2008-06-11 13:54 ` Theodore Tso
2008-06-11 20:21 ` Holger Kiehl
2008-06-12 1:35 ` Theodore Tso
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=20080623174508.GA7216@skywalker \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=Holger.Kiehl@dwd.de \
--cc=Solofo.Ramangalahy@bull.net \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nicholas.dokos@hp.com \
--cc=sandeen@redhat.com \
--cc=tytso@mit.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.