Re: [2.6] smbfs & "du" illness

From: Jeremy Allison
Date: Sat Sep 25 2004 - 13:22:34 EST


On Sat, Sep 25, 2004 at 11:12:04AM -0700, Linus Torvalds wrote:
>
> Btw, if you want to send bytes instead of blocks, I don't care. The Linux
> client can easily do
>
> blocks = bytes >> 9;
>
> and I'll be perfectly happy.

Good - that's all that needs doing.

> But if the "bytes" count you send has no
> actual real-life meaning (ie it didn't actually come from the underlying
> filesystem at all), then don't bother. The client might as well do
>
> blocks = (filesize + 511) >> 9;
>
> if that's what the server is (badly) mangling.

No, the number does have real life meaning if the underlying
OS supports st_blocks and st_blksize. We test for the presense
of these in configure (as they're not POSIX) and send the
correct values as bytes if they are there. We (smbd) takes care
of scaling them into bytes instead of the client having to
know if it's talking to HPUX in which case it's in 8192
byte units, or to VOS etc. etc.

To recap, if we have st_blocks from the filesystem we use it
and send the value scaled as bytes, if not we send the actual
file size there in bytes (as we know any POSIX system has at
least that).

Happy ?

Jeremy.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/