Hi Donato, On Wed, Jul 8, 2009 at 2:57 PM, Donato Capitella<d.capitella@xxxxxx> wrote: > Two things: > > 1) the linker can't find ext3_sync_inode(), so can't I. I can only find > the extern declaration using lxr, but there's no implementation in > kernel 2.6.29 (according to lxr and to the linker) > Yes, I do see some issues there. The definition is missing completely. try using sync_inode, the vfs layer. This is exported and you can easily use it in your module. > 2) Anyhow, that doesn't seem to be the real problem. If I execute this > code passing a non-reserved inode, it works like a charm. This should > suggest me something, but it doesn't. > That is really strange. So, as per you the size is not getting updated. right? What if you umount and remount the file system? Check if it gets updated then. > Now I'm stuck, again (XD) > Thanks, > Donato > > On Wed, 2009-07-08 at 14:23 +0530, SandeepKsinha wrote: >> Hi Donato, >> >> On Wed, Jul 8, 2009 at 1:14 PM, Donato Capitella<d.capitella@xxxxxx> wrote: >> > Hi there, >> > I wrote a dummy function to write to the reserved inode. This is as far >> > as I got and I have a few questions: >> > >> > /**************************************************************/ >> > void dummy_write_to_inode(struct inode *ino) >> > { >> > struct buffer_head *bh; >> > handle_t *handle; >> > int err, blk; >> > char dummy_text[] = "The crazy fox jumps over the lazy dog!"; >> > >> > handle = ext3_start_journal(inode, 2); >> > if (IS_ERR(handle)) >> > goto err; >> > >> > /* allocate a block */ >> > blk = ext3_new_block(handle, inode, 1, &err); >> > if (err) >> > goto err; >> > >> > EXT3_I(inode)->i_data[0] = blk >> > >> > /* write something to the block */ >> > bh = sb_bread(ino->sb, blk); >> > if (IS_ERR(bh)) >> > goto err; >> > >> > memcpy(bh->b_data, dummy_text, sizeof(dummy_text)); >> > mark_buffer_dirty(bh); >> > brelse(bh); >> > >> > i_size_write(inode, sizeof(dummy_text)); >> > mark_inode_dirty(inode); >> > >> ext3_sync_inode(handle, ino); >> >> > ext3_journal_stop(handle); >> > >> > >> > err: >> > /* ... error handling code ... */ >> > } >> > /**************************************************************/ >> > >> > For some reason, this code doesn't work as I expected. The block is >> > actually written and at the end contains "The lazy fox jumps over the >> > lazy dog". The problem is with the inode: it just gets partially >> > updated. The block pointer to the first block is updated but the size >> > stays zero. How is it possibile that half of the inode gets updated and >> > the other half doesn't? What am I missing here? >> > >> >> try syncing the inode. This should probably help. >> >> > Thanks, >> > Donato >> > >> > p.s.: I'd also like to know if there is a "smarter" way to write to an >> > inode that automatically allocates blocks when needed and the like... >> > >> >> > >> > -- >> > To unsubscribe from this list: send an email with >> > "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx >> > Please read the FAQ at http://kernelnewbies.org/FAQ >> > >> > >> >> >> > > -- Regards, Sandeep. “To learn is to change. Education is a process that changes the learner.” -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ