On Wed, 12 Oct 2011 16:22:25 +0400 Pavel Shilovsky <piastryyy@xxxxxxxxx> wrote: > 2011/10/11 Jeff Layton <jlayton@xxxxxxxxxx>: > ... > > + > > + /* > > + * Set default value... > > + * > > + * HACK alert! Ancient servers have very small buffers. Even though > > + * MS-CIFS indicates that servers are only limited by the client's > > + * bufsize for reads, testing against win98se shows that it throws > > + * INVALID_PARAMETER errors if you try to request too large a read. > > + * > > + * If the server advertises a MaxBufferSize of less than one page, > > + * assume that it also can't satisfy reads larger than that either. > > + * > > + * FIXME: Is there a better heuristic for this? > > + */ > > + if (tcon->unix_ext && (unix_cap & CIFS_UNIX_LARGE_READ_CAP)) > > + defsize = CIFS_DEFAULT_IOSIZE; > > + else if (server->capabilities & CAP_LARGE_READ_X) > > + defsize = CIFS_DEFAULT_NON_POSIX_RSIZE; > > + else if (server->maxBuf >= PAGE_CACHE_SIZE) > > + defsize = CIFSMaxBufSize; > > + else > > + defsize = server->maxBuf - sizeof(READ_RSP); > > + > > So, if the max buffer size that the server supports is greater or > equal that PAGE_CACHE_SIZE than we set it to CIFSMaxBufSize. But if > maxBuf is less than CIFSMaxBufSize? I think the server refects such a > request. > I guess you mean "rejects" ? In principle, the server's maxBuf should have no bearing at all on the size of a read that it can satisfy. In practice though, it seems like much older servers (such as win9x era) *do* have such a limitation. We have no clear way to identify such servers though, so I came up with this one (maxBuf less than PAGE_CACHE_SIZE). I'm open to suggestions for a better heuristic here if you have one. Note too that this is just the default setting, and the user can override it if they wish. -- Jeff Layton <jlayton@xxxxxxxxxx> -- To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html