Preallocated file size...

David Collier-Brown davecb at canada.sun.com
Tue Feb 8 19:46:17 GMT 2000


"Cole, Timothy D." wrote:
> >       Do you mean if I ask for 4 KB and only have one
> >       left, I get 1 KB of data and 3 KB of nulls?
> >
>         No, it means that if you ask for 4KB, the file length is set to 4KB,
> and you get 0KB, until such time as you actually try to write to it.  Blocks
> are allocated on an as-needed basis.  This is standard POSIX behavior.

	[sorry, I was in a meeting]

	Ok, so the client's explicitly set the file length, then,
	instead of trying to write a 4 KB block onto the end of 
	the file? Phew, I thought you meant the latter!

	I was looking at the Win95 and <unknown version>
	NT traces, and did not see any operation to set 
	the length...  My copy of Luke's book is at home,
	so I can't just look it up (:-))

	So: if [they're setting the length]; then
		Unix will write a holey file, and the
		client had better get told "no space"
		when they try to set the length, as
		Jeremy suggested.
	else 
		We'll have to truncate on write failure.
	fi

	The latter probably needs to be restricted to sequential
	writes, though: I suspect that random files might become
	sorta short if I run out of space while writing a new block
	near the beginning (;-))

--dave 
-- 
David Collier-Brown,  | Always do right. This will gratify some people
185 Ellerslie Ave.,   | and astonish the rest.        -- Mark Twain
Willowdale, Ontario   | //www.oreilly.com/catalog/samba/author.html
Work: (905) 415-2849 Home: (416) 223-8968 Email: davecb at canada.sun.com


More information about the samba-technical mailing list