public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Darren Hart <dvhart@infradead.org>
To: linux-ext4 <linux-ext4@vger.kernel.org>
Subject: [e2fsprogs] initdir: Writing inode after the initial write?
Date: Fri, 30 Nov 2012 18:13:54 -0800	[thread overview]
Message-ID: <50B967E2.7090703@infradead.org> (raw)

I am working on creating some files after creating a filesystem in
mke2fs. This is part of a larger project to add initial directory
support to mke2fs. To make it easy for people to see what I'm working
on, I've pushed my dev tree here:

http://git.infradead.org/users/dvhart/e2fsprogs/shortlog/refs/heads/initialdir

Note: the code is still just in the prototyping state. It is inelegant
to say the least. The git tree will most definitely rebase. I'm trying
to get it functional, once that is understand, I will refactor
appropriately.

I can create a simple directory structure and link in files and fast
symlinks. I'm currently working on copying content from files in the
initial directory. The process I'm using is as follows:


ext2fs_new_inode(&ino)
ext2fs_link()

ext2fs_read_inode(ino, &inode)
/* some initial inode setup */
ext2fs_write_new_inode(ino, &inode)

ext2fs_file_open2(&inode)
ext2fs_write_file()
ext2fs_file_close()

inode.i_size = bytes_written
ext2fs_write_inode()

ext2fs_inode_alloc_stats2(ino)


When I mount the image, the size for the file is correct, by catting it
returns nothing. If I instead hack in the known size during the initial
inode setup and drop the last ext2fs_write_inode() call, then the size
is right and catting the file works as expected.

Is it incorrect to write the inode more than once? If not, am I doing
something that is somehow decoupling the block where the data was
written from the inode associated with the file?

Thanks,

-- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Technical Lead - Linux Kernel

             reply	other threads:[~2012-12-01  2:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-01  2:13 Darren Hart [this message]
2012-12-01  4:23 ` [e2fsprogs] initdir: Writing inode after the initial write? Andreas Dilger
2012-12-01  5:08   ` Darren Hart
2012-12-01 19:31     ` Andreas Dilger
2012-12-03 19:46       ` Darren Hart
2012-12-04 10:45         ` Yongqiang Yang
2012-12-04 17:42           ` Darren Hart
2012-12-04 10:59         ` Andreas Dilger
2012-12-04 17:43           ` Darren Hart
2012-12-04 19:08             ` Theodore Ts'o
2012-12-04 19:40               ` Darren Hart
2012-12-04 20:00                 ` Theodore Ts'o
2012-12-04 20:10                   ` Darren Hart
2012-12-04 20:36                     ` Theodore Ts'o
2012-12-04 15:22         ` Theodore Ts'o
2012-12-04 17:46           ` Darren Hart
2012-12-04 19:24             ` Theodore Ts'o

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=50B967E2.7090703@infradead.org \
    --to=dvhart@infradead.org \
    --cc=linux-ext4@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