How can you "un-sparse" a file without re-creating the entire file (including its streams, security

MSDN documentation indicates that you can’t …

“The FSCTL_SET_SPARSE control code sets the FILE_ATTRIBUTE_SPARSE_FILE attribute of the specified file. The only way to clear this attribute is to overwrite the file, for example, by calling the CreateFile function with the CREATE_ALWAYS flag…”

However, the RSS service will sparse a file’s stream and create a single sparse region that represents the file’s old content, thereby preserving its file size. How can RSS retrieve the data stream of the file without replacing all the file attributes and streams if you have to re-create the file? Or, can I truncate the default file stream, clear the sparse flag and re-write the file’s default stream using kernel mode interface (or user mode NT primitives)? Effectively, is this MSDN documentation a limitation of only the WIN32 API?

You can’t clear the sparse attribute once you issue FSCTL_SET_SPARSE.
RSS leaves the files ‘sparse’ - however RSS’ed files are either
completely truncated or fully restored
(one allocated range)
Ravi

-----Original Message-----
From: Tom Hansen [mailto:xxxxx@inflectionsystems.com]
Sent: Friday, November 01, 2002 1:46 PM
To: File Systems Developers
Subject: [ntfsd] How can you “un-sparse” a file without re-creating the
entire file (including its streams, security data, etc.)

MSDN documentation indicates that you can’t …

“The FSCTL_SET_SPARSE control code sets the FILE_ATTRIBUTE_SPARSE_FILE
attribute of the specified file. The only way to clear this attribute is
to overwrite the file, for example, by calling the CreateFile function
with the CREATE_ALWAYS flag…”

However, the RSS service will sparse a file’s stream and create a single
sparse region that represents the file’s old content, thereby preserving
its file size. How can RSS retrieve the data stream of the file without
replacing all the file attributes and streams if you have to re-create
the file? Or, can I truncate the default file stream, clear the sparse
flag and re-write the file’s default stream using kernel mode interface
(or user mode NT primitives)? Effectively, is this MSDN documentation a
limitation of only the WIN32 API?


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