From: 内核追踪 <kerneltrack@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: question about __block_commit_write
Date: Mon, 28 May 2007 18:59:31 +0800 [thread overview]
Message-ID: <4a3acf9f0705280359s2d4d507bs97d060889f44ba41@mail.gmail.com> (raw)
Hi, all.
In the snippet code, I add a printk into block_commit_write, I want
to get the bh's block number and device number . I recompiled it in
2.4.20. But I surprise that mutliple output lines are the same.
static int __block_commit_write(struct inode *inode, struct page
*page, unsigned from, unsigned to)
{
unsigned block_start, block_end;
int partial = 0, need_balance_dirty = 0;
unsigned blocksize;
struct buffer_head *bh, *head;
blocksize = 1 << inode->i_blkbits;
for(bh = head = page->buffers, block_start = 0;
bh != head || !block_start;
block_start=block_end, bh = bh->b_this_page) {
block_end = block_start + blocksize;
if (block_end <= from || block_start >= to) {
if (!buffer_uptodate(bh))
partial = 1;
} else {
@+ printk(KERN_ERR"dev is %d, blocknr is %d\n", bh->b_dev, bh->b_blocknr);
set_bit(BH_Uptodate, &bh->b_state);
if (!atomic_set_buffer_dirty(bh)) {
__mark_dirty(bh);
buffer_insert_inode_data_queue(bh, inode);
need_balance_dirty = 1;
}
}
}
if (need_balance_dirty)
balance_dirty();
/*
* is this a partial write that happened to make all buffers
* uptodate then we can optimize away a bogus readpage() for
* the next read(). Here we 'discover' wether the page went
* uptodate as a result of this (potentially partial) write.
*/
if (!partial)
SetPageUptodate(page);
return 0;
}
The ouput is following :
dev is 5640, blocknr is 14223
dev is 5640, blocknr is 14223
dev is 5640, blocknr is 14223
dev is 5640, blocknr is 14223
dev is 5640, blocknr is 14223
dev is 5640, blocknr is 14223
.....
I do not know why happened like these?
reply other threads:[~2007-05-28 10:59 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=4a3acf9f0705280359s2d4d507bs97d060889f44ba41@mail.gmail.com \
--to=kerneltrack@gmail.com \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®