NTFS: size in dirent and in MFT record

NTFS seems to keep these sizes out of sync. After writing to a
file and extending it, the dirent size is not immediately increased. I
expect it is synced in CLEANUP path or such.
Is there any way to force synchronize this? preferrable for a
whole volume in one call?

Max

The file size and date/time stamps are stored in the directory as well as the MFT in order to optimize directory queries. The MFT is the authoritative reference. You can observe this by creating a hard linked file and modifying the file through one of its names. The directory listing for its other name will show stale size and date/time stamps until the file is accessed through its other name. If you query the file size from the file instead of the directory, you should get the correct value.

-----Original Message-----
From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
Sent: Tuesday, July 16, 2002 5:00 PM
To: File Systems Developers
Subject: [ntfsd] NTFS: size in dirent and in MFT record

NTFS seems to keep these sizes out of sync. After writing to a
file and extending it, the dirent size is not immediately increased. I
expect it is synced in CLEANUP path or such.
Is there any way to force synchronize this? preferrable for a
whole volume in one call?

Max


You are currently subscribed to ntfsd as: xxxxx@inin.com
To unsubscribe send a blank email to %%email.unsub%%

I was browsing the Platform SDK documentation on CreateHardLink and found something patently wrong, or at least very misleading. The SDK claims, “Also, all of the directory entries are updated if the file changes. For example, if the file’s size changes, all of the hard links to the file will show the new size.” This is only true after all the hard links are used to access the file (as opposed to merely accessing their parent directories.) Until then, they’ll show the old size and date/time stamp. Of course anybody who has done much Windows programming knows the Platform SDK is not the authoritative reference on Windows behavior. You can verify this unusual behavior with hard links with the following program that is used like “ln” on UNIX:

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>

void main(int argc, char **argv)
{
if (argc != 3)
{
fprintf(stderr, “usage: %s \n”, argv[0]);
exit(EXIT_FAILURE);
}

if (TRUE != CreateHardLink(argv[2], argv[1], NULL))
{
fprintf(stderr, “fatal: CreateHardLink failed with Win32 error %d\n”, GetLastError());
exit(EXIT_FAILURE);
}

exit(EXIT_SUCCESS);
}

-----Original Message-----
From: Fuller, Rob
Sent: Tuesday, July 16, 2002 5:19 PM
To: File Systems Developers
Subject: [ntfsd] RE: NTFS: size in dirent and in MFT record

The file size and date/time stamps are stored in the directory as well as the MFT in order to optimize directory queries. The MFT is the authoritative reference. You can observe this by creating a hard linked file and modifying the file through one of its names. The directory listing for its other name will show stale size and date/time stamps until the file is accessed through its other name. If you query the file size from the file instead of the directory, you should get the correct value.

-----Original Message-----
From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
Sent: Tuesday, July 16, 2002 5:00 PM
To: File Systems Developers
Subject: [ntfsd] NTFS: size in dirent and in MFT record

NTFS seems to keep these sizes out of sync. After writing to a
file and extending it, the dirent size is not immediately increased. I
expect it is synced in CLEANUP path or such.
Is there any way to force synchronize this? preferrable for a
whole volume in one call?

Max


You are currently subscribed to ntfsd as: xxxxx@inin.com
To unsubscribe send a blank email to %%email.unsub%%


You are currently subscribed to ntfsd as: xxxxx@inin.com
To unsubscribe send a blank email to %%email.unsub%%</stdlib.h></stdio.h></windows.h>