Date: Wed, 02 Oct 1996 07:52:03 -0700 From: David Greenman <dg@root.com> To: Heo Sung-Gwan <heo@cslsun10.sogang.ac.kr> Cc: freebsd-hackers@freebsd.org, freebsd-fs@freebsd.org Subject: Re: vnode and cluster read-ahead Message-ID: <199610021452.HAA07229@root.com> In-Reply-To: Your message of "Wed, 02 Oct 1996 23:17:03 %2B0900." <Pine.SUN.3.93.961002231449.5132A-100000@cslsun10>
next in thread | previous in thread | raw e-mail | index | archive | help
>When a file is open serveral times simultaneously cluster read-ahead >buffer cache using vnode seem to have some problems. > >As a process A reads a file F *sequentially* the fields(v_maxra, v_ralen, etc) of the vnode of F increases. As a result read-ahead of next cluster happens. >But when a process B opens F and reads it the values of the fields are >changed. So the process A's read-ahead is disturbed whenever process B is >rescheduled. > >I think the fields for read-ahead must be in struct file rather than vnode. >There exists one vnode for a file but a file may be open serveral times. > >What's your opinion, hackers? First, this is a very rare situation that almost never occurs in practice. If the file was just read it will usually still be in the cache (assuming it's not too large), so all references will be satisfied out of the cache and the clustering policy won't matter. However, in the case of it not fitting in the cache, the system will not optimize for sequential reads because they are no longer entirely sequential...so I think the current algorithm is doing the right thing. The whole dynamic read-ahead mechanism is just an optimization in any case and is new with 4.4BSD. Even if we did want to change it, there really isn't a way to do what you're suggesting above - you don't have access to the file struct at the level that the clustering decision is made. You'd have to change the code to propagate clustering hints from the read/write system calls. Yuck. -DG David Greenman Core-team/Principal Architect, The FreeBSD Project
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199610021452.HAA07229>