mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* question about __block_commit_write
@ 2007-05-28 10:59 内核追踪
  0 siblings, 0 replies; only message in thread
From: 内核追踪 @ 2007-05-28 10:59 UTC (permalink / raw)
  To: linux-kernel

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?

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-05-28 10:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-28 10:59 question about __block_commit_write 内核追踪

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®