public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Theodore Tso <tytso@mit.edu>
To: "홍신 shin hong" <hongshin@gmail.com>
Cc: Jan Kara <jack@suse.cz>, linux-ext4@vger.kernel.org
Subject: Re: a question for i_inode's i_size in ext2
Date: Fri, 26 Sep 2008 10:41:54 -0400	[thread overview]
Message-ID: <20080926144154.GD11413@mit.edu> (raw)
In-Reply-To: <2014bcab0809252152i6fef9babx242e821c4f0d5a7b@mail.gmail.com>

On Fri, Sep 26, 2008 at 01:52:13PM +0900, 홍신 shin hong wrote:
>   Thank you for the answering.
> 
>   In ext2, it seems to me that inode's i_size field can be accessed without
> holding i_mutex
>   nor thorugh i_size_read function.
> 
>   For example, in ext2_update_inode() can be invoked without holding
> i_mutex.
>   However, it freely access i_size field.
> 
>   Are these accesses can race with each others?
> 

ext2_update_inode() is responsible for writing the contents of the
inode to disk.  So it simply saves the current version of the object
to persistent storage.  If the inode happens to be in the middle of
being modified, the inode will be redirtied (the rule for modifying
objects like inodes is you modify them first, *then* set the dirty bit
after you are done modifying the object).  So if another kernel thread
is in the middle of updating the object, it's not a big deal; the
updated version of the inode will get written to disk later.

Ext2 has no guarantees about filesystem consistency after a crash (you
have to run fsck after a crash), so this is OK.

     	    	       	 	    	    - Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      parent reply	other threads:[~2008-09-26 14:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-19  7:21 a question for i_inode's i_size in ext2 홍신 shin hong
2008-09-19 23:32 ` Theodore Tso
2008-09-20  3:25 ` Jan Kara
2008-09-20  6:35   ` Theodore Tso
     [not found]     ` <2014bcab0809252152i6fef9babx242e821c4f0d5a7b@mail.gmail.com>
2008-09-26  4:53       ` 홍신 shin hong
2008-09-26 14:41       ` Theodore Tso [this message]

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=20080926144154.GD11413@mit.edu \
    --to=tytso@mit.edu \
    --cc=hongshin@gmail.com \
    --cc=jack@suse.cz \
    --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