question about __block_commit_write

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux