Date: Fri, 4 Jan 2002 16:47:15 -0800 (PST) From: Matthew Dillon <dillon@apollo.backplane.com> To: Alfred Perlstein <bright@mu.org> Cc: fs@FreeBSD.ORG Subject: Re: open("", O_DIRECT) broken. Message-ID: <200201050047.g050lFg89490@apollo.backplane.com> References: <20020104172833.R82406@elvis.mu.org>
next in thread | previous in thread | raw e-mail | index | archive | help
:Open passed the O_DIRECT flag seems broken, instead of doing the :right thing which would be just to penalize buffers not in the :cache, what it does (at least from casual observation in ufs_readwrite) :is mark _all_ buffers read via a O_DIRECT file as wanting to be :discarded, this is bogus as you may read via an O_DIRECT method the :entire file and invalidate the cache of another process accessing :the same file. : :It would be much better to pass O_DIRECT down to bread{n} which :would only mark it as B_DIRECT if it's not found in the cache. : :The idea is to not be distruptive to the cache, not to prematurely :toss away buffers that may be otherwise benifiting from heavy cache :utilization. : :-- :-Alfred Perlstein [alfred@freebsd.org] I agree with your reasoning, but I am not about to change the semantics of bread(). bread is used everywhere. In fact, it is used so often that I would be mightily nervous bloating it with another argument. The current implementation works reasonably well for the most common use of O_DIRECT I/O, where generally certain portions of a file will always be accessed O_DIRECT while other portions will always be accessed without O_DIRECT. For example, when accessing a large database you may wish to allow the OS to cache management structures like embedded hash tables, but do your own caching of the (possibly terrabytes) of data in order to make the most efficient use of the cpu by avoiding unexpected blockages. -Matt Matthew Dillon <dillon@backplane.com> To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-fs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200201050047.g050lFg89490>