tree 3fc9f181a1666eff445bdb6a243dd4e080c233f9
parent da28438cae9a271c5c232177f81dfb243de9b7fa
author Anton Altaparmakov <[EMAIL PROTECTED]> Thu, 11 Nov 2004 12:34:00 +0000
committer Anton Altaparmakov <[EMAIL PROTECTED]> Wed, 04 May 2005 16:57:47 +0100

NTFS: Use i_size_read() in fs/ntfs/logfile.c::ntfs_{check,empty}_logfile().

Signed-off-by: Anton Altaparmakov <[EMAIL PROTECTED]>

 fs/ntfs/ChangeLog |   25 ++++++++++++-------------
 fs/ntfs/logfile.c |    5 +++--
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog
--- a/fs/ntfs/ChangeLog
+++ b/fs/ntfs/ChangeLog
@@ -2,20 +2,18 @@ ToDo/Notes:
        - Find and fix bugs.
        - Checkpoint or disable the user space journal ($UsnJrnl).
        - In between ntfs_prepare/commit_write, need exclusion between
-         simultaneous file extensions. Need perhaps an NInoResizeUnderway()
-         flag which we can set in ntfs_prepare_write() and clear again in
-         ntfs_commit_write(). Just have to be careful in readpage/writepage,
-         as well as in truncate, that we play nice... We might need to have
-         a data_size field in the ntfs_inode to store the real attribute
-         length. Also need to be careful with initialized_size extention in
+         simultaneous file extensions.  This is given to us by holding i_sem
+         on the inode.  The only places in the kernel when a file is resized
+         are prepare/commit write and truncate for both of which i_sem is
+         held.  Just have to be careful in readpage/writepage and all other
+         helpers not running under i_sem that we play nice...
+         Also need to be careful with initialized_size extention in
          ntfs_prepare_write. Basically, just be _very_ careful in this code...
-         OTOH, perhaps i_sem, which is held accross generic_file_write is
-         sufficient for synchronisation here. We then just need to make sure
-         ntfs_readpage/writepage/truncate interoperate properly with us.
-         UPDATE: The above is all ok as it is due to i_sem held.  The only
-         thing that needs to be checked is ntfs_writepage() which does not
-         hold i_sem.  It cannot change i_size but it needs to cope with a
-         concurrent i_size change.
+         UPDATE: The only things that need to be checked are read/writepage
+         which do not hold i_sem.  Note writepage cannot change i_size but it
+         needs to cope with a concurrent i_size change, just like readpage.
+         Also both need to cope with concurrent changes to the other sizes,
+         i.e. initialized/allocated/compressed size, as well.
        - Implement mft.c::sync_mft_mirror_umount().  We currently will just
          leave the volume dirty on umount if the final iput(vol->mft_ino)
          causes a write of any mirrored mft records due to the mft mirror
@@ -32,6 +30,7 @@ ToDo/Notes:
          attack.  Thanks to Carl-Daniel Hailfinger from SuSE for pointing this
          out.
        - Use i_size_read() in fs/ntfs/attrib.c::ntfs_attr_set().
+       - Use i_size_read() in fs/ntfs/logfile.c::ntfs_{check,empty}_logfile().
 
 2.1.22 - Many bug and race fixes and error handling improvements.
 
diff --git a/fs/ntfs/logfile.c b/fs/ntfs/logfile.c
--- a/fs/ntfs/logfile.c
+++ b/fs/ntfs/logfile.c
@@ -443,7 +443,7 @@ BOOL ntfs_check_logfile(struct inode *lo
        /* An empty $LogFile must have been clean before it got emptied. */
        if (NVolLogFileEmpty(vol))
                goto is_empty;
-       size = log_vi->i_size;
+       size = i_size_read(log_vi);
        /* Make sure the file doesn't exceed the maximum allowed size. */
        if (size > MaxLogFileSize)
                size = MaxLogFileSize;
@@ -689,7 +689,8 @@ BOOL ntfs_empty_logfile(struct inode *lo
        if (!NVolLogFileEmpty(vol)) {
                int err;
                
-               err = ntfs_attr_set(NTFS_I(log_vi), 0, log_vi->i_size, 0xff);
+               err = ntfs_attr_set(NTFS_I(log_vi), 0, i_size_read(log_vi),
+                               0xff);
                if (unlikely(err)) {
                        ntfs_error(vol->sb, "Failed to fill $LogFile with "
                                        "0xff bytes (error code %i).", err);
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to