[<prev] [next>] [day] [month] [year] [list]
Message-ID: <4a3acf9f0705280359s2d4d507bs97d060889f44ba41@mail.gmail.com>
Date: Mon, 28 May 2007 18:59:31 +0800
From: "内核追踪" <kerneltrack@...il.com>
To: linux-kernel@...r.kernel.org
Subject: question about __block_commit_write
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?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists