Date: Tue, 25 May 1999 13:29:27 +0430 (IRST) From: Farshid Eslami <farshid@bol.sharif.ac.ir> To: Alfred Perlstein <bright@rush.net> Cc: fs@FreeBSD.ORG Subject: Re: how are partial writes handled in FFS? Message-ID: <Pine.LNX.3.96.990525132055.651C-100000@peik.bol.sharif.ac.ir> In-Reply-To: <Pine.BSF.3.96.990524194259.9491a-100000@cygnus.rush.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 24 May 1999, Alfred Perlstein wrote: I've not read the FFS code in detail, but as far as I know, if write is not block-aligned, the block should be read from disk and then the write syscall updates the necessary data in block. Otherwise, if the write is block-aligned, there is no need to read the block from disk because all of the block is going to be overwitten. So why should the data that will be overwirtten be read from disk? In this case, there is no need to pay the cost of a read from disk. A block should be assigned from buffer cache to write and write copies the data to the buffer. Again in this case, the content of the buffer is not needed to be zero or any thing else, because all the buffer is overwirtten by write syscall. These are for cached write. For uncached write, it's done through raw device. I don't know exactly how it handles this, but the policy is straight forward. One more point is that if the write in uncached, there is no need to copy data, which size is a multiple of block size, into a separate buffer. There write syscall can send out data directly from user space to device. --Farshid : : considering a (dumb) process that writes to a file calling write() : several times. The writes are done to a buffer, but let's say the : buffer is uncached, what exactly happens? : : does: : A) it fetch the block off disk the write the data into it? : b) a block is allocated for the data and the partial write : is done to it maintaining the offset of the write, the buffer : is marked so that before it : is sync'd back to disk (or any reading from a location not : within the partial write) that a buffer must be allocated, and : the on disk data must be read into the buffer, then merged into : the partially written buffer. : : If it is B, or if sometimes B is a possiblity, can someone show me : where the code that does this is located? : : thanks, : -Alfred : : : : To Unsubscribe: send mail to majordomo@FreeBSD.org : with "unsubscribe freebsd-fs" in the body of the message : Farshid Eslami farshidoo@yahoo.com ----------------------------------------------------------- Without passion man is a mere latent force and possibility, like the flint which awaits the shock of the iron before it can give forth its spark. 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?Pine.LNX.3.96.990525132055.651C-100000>