diff options
author | Anton Altaparmakov <aia21@cantab.net> | 2004-11-11 07:34:00 -0500 |
---|---|---|
committer | Anton Altaparmakov <aia21@cantab.net> | 2005-05-04 11:57:47 -0400 |
commit | 66129f88c4cc719591f687e5c8c764fe9d3e437a (patch) | |
tree | 3fc9f181a1666eff445bdb6a243dd4e080c233f9 | |
parent | da28438cae9a271c5c232177f81dfb243de9b7fa (diff) |
NTFS: Use i_size_read() in fs/ntfs/logfile.c::ntfs_{check,empty}_logfile().
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
-rw-r--r-- | fs/ntfs/ChangeLog | 25 | ||||
-rw-r--r-- | fs/ntfs/logfile.c | 5 |
2 files changed, 15 insertions, 15 deletions
diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog index 9c4e78a8e4b1..b1a949401be3 100644 --- a/fs/ntfs/ChangeLog +++ b/fs/ntfs/ChangeLog | |||
@@ -2,20 +2,18 @@ ToDo/Notes: | |||
2 | - Find and fix bugs. | 2 | - Find and fix bugs. |
3 | - Checkpoint or disable the user space journal ($UsnJrnl). | 3 | - Checkpoint or disable the user space journal ($UsnJrnl). |
4 | - In between ntfs_prepare/commit_write, need exclusion between | 4 | - In between ntfs_prepare/commit_write, need exclusion between |
5 | simultaneous file extensions. Need perhaps an NInoResizeUnderway() | 5 | simultaneous file extensions. This is given to us by holding i_sem |
6 | flag which we can set in ntfs_prepare_write() and clear again in | 6 | on the inode. The only places in the kernel when a file is resized |
7 | ntfs_commit_write(). Just have to be careful in readpage/writepage, | 7 | are prepare/commit write and truncate for both of which i_sem is |
8 | as well as in truncate, that we play nice... We might need to have | 8 | held. Just have to be careful in readpage/writepage and all other |
9 | a data_size field in the ntfs_inode to store the real attribute | 9 | helpers not running under i_sem that we play nice... |
10 | length. Also need to be careful with initialized_size extention in | 10 | Also need to be careful with initialized_size extention in |
11 | ntfs_prepare_write. Basically, just be _very_ careful in this code... | 11 | ntfs_prepare_write. Basically, just be _very_ careful in this code... |
12 | OTOH, perhaps i_sem, which is held accross generic_file_write is | 12 | UPDATE: The only things that need to be checked are read/writepage |
13 | sufficient for synchronisation here. We then just need to make sure | 13 | which do not hold i_sem. Note writepage cannot change i_size but it |
14 | ntfs_readpage/writepage/truncate interoperate properly with us. | 14 | needs to cope with a concurrent i_size change, just like readpage. |
15 | UPDATE: The above is all ok as it is due to i_sem held. The only | 15 | Also both need to cope with concurrent changes to the other sizes, |
16 | thing that needs to be checked is ntfs_writepage() which does not | 16 | i.e. initialized/allocated/compressed size, as well. |
17 | hold i_sem. It cannot change i_size but it needs to cope with a | ||
18 | concurrent i_size change. | ||
19 | - Implement mft.c::sync_mft_mirror_umount(). We currently will just | 17 | - Implement mft.c::sync_mft_mirror_umount(). We currently will just |
20 | leave the volume dirty on umount if the final iput(vol->mft_ino) | 18 | leave the volume dirty on umount if the final iput(vol->mft_ino) |
21 | causes a write of any mirrored mft records due to the mft mirror | 19 | causes a write of any mirrored mft records due to the mft mirror |
@@ -32,6 +30,7 @@ ToDo/Notes: | |||
32 | attack. Thanks to Carl-Daniel Hailfinger from SuSE for pointing this | 30 | attack. Thanks to Carl-Daniel Hailfinger from SuSE for pointing this |
33 | out. | 31 | out. |
34 | - Use i_size_read() in fs/ntfs/attrib.c::ntfs_attr_set(). | 32 | - Use i_size_read() in fs/ntfs/attrib.c::ntfs_attr_set(). |
33 | - Use i_size_read() in fs/ntfs/logfile.c::ntfs_{check,empty}_logfile(). | ||
35 | 34 | ||
36 | 2.1.22 - Many bug and race fixes and error handling improvements. | 35 | 2.1.22 - Many bug and race fixes and error handling improvements. |
37 | 36 | ||
diff --git a/fs/ntfs/logfile.c b/fs/ntfs/logfile.c index 5e280abafab3..e680dd0cdb64 100644 --- a/fs/ntfs/logfile.c +++ b/fs/ntfs/logfile.c | |||
@@ -443,7 +443,7 @@ BOOL ntfs_check_logfile(struct inode *log_vi) | |||
443 | /* An empty $LogFile must have been clean before it got emptied. */ | 443 | /* An empty $LogFile must have been clean before it got emptied. */ |
444 | if (NVolLogFileEmpty(vol)) | 444 | if (NVolLogFileEmpty(vol)) |
445 | goto is_empty; | 445 | goto is_empty; |
446 | size = log_vi->i_size; | 446 | size = i_size_read(log_vi); |
447 | /* Make sure the file doesn't exceed the maximum allowed size. */ | 447 | /* Make sure the file doesn't exceed the maximum allowed size. */ |
448 | if (size > MaxLogFileSize) | 448 | if (size > MaxLogFileSize) |
449 | size = MaxLogFileSize; | 449 | size = MaxLogFileSize; |
@@ -689,7 +689,8 @@ BOOL ntfs_empty_logfile(struct inode *log_vi) | |||
689 | if (!NVolLogFileEmpty(vol)) { | 689 | if (!NVolLogFileEmpty(vol)) { |
690 | int err; | 690 | int err; |
691 | 691 | ||
692 | err = ntfs_attr_set(NTFS_I(log_vi), 0, log_vi->i_size, 0xff); | 692 | err = ntfs_attr_set(NTFS_I(log_vi), 0, i_size_read(log_vi), |
693 | 0xff); | ||
693 | if (unlikely(err)) { | 694 | if (unlikely(err)) { |
694 | ntfs_error(vol->sb, "Failed to fill $LogFile with " | 695 | ntfs_error(vol->sb, "Failed to fill $LogFile with " |
695 | "0xff bytes (error code %i).", err); | 696 | "0xff bytes (error code %i).", err); |