[lc-checkins] CVS: linux/fs buffer.c,1.11,NONE
Status: Beta
Brought to you by:
nitin_sf
From: Rodrigo S. de C. <rc...@us...> - 2002-01-10 12:39:33
|
Update of /cvsroot/linuxcompressed/linux/fs In directory usw-pr-cvs1:/tmp/cvs-serv10033/fs Removed Files: buffer.c Log Message: This batch of changes includes cleanups and code rewrites. The swap_out_fragments() and find_free_swap_buffer() are much simpler and also more efficient. Some preliminary tests showed a performance gain due to these improvements. - Fragment Freed Bit removed: the current code has been checked by and the few parts in the code where we could sleep with a comp page in locked state were rewritten (mainly swap out). It turns out that now we won't free a fragment without locking its page, and thus we don't need a bit to tell that the fragment needs to be freed. All special cases for Freed bit all over the code were removed. - Fragment SwapBuffer Bit removed: things changed a lot in swap buffer code. We don't add a "virtual" fragment to the comp cache hash table to avoid access to fragments which may be in swap out process. So, no need for this bit currently. - Fragment IO Bit added: instead of added a "virtual" fragment to the comp cache hash table, we don't free the fragment we are swapping out right after the IO function (rw_swap_page) has been called. We free it only when the IO has finished. But once the IO takes time, this fragment can be freed (maybe because it's been swapped in) in the meanwhile and so we have to tell the comp_cache_free() that this fragment is being written to disk and that its struct should not be freed. comp_cache_free() also clears this bit since we don't need to perform the IO (if it has not yet been submitted). In the case it has already been submitted, we don't have to free this fragment, only its struct. - find_free_swp_buffer() function was completely rewritten. There are two lists linking all the swap buffer pages: used and free. The comp page field in swp_buffer_t was removed. No array for swap buffers is needed, since they are linked in these lists (it's the first step to make it work with dynamic swap buffers, like listed on todo list). About its behaviour, there's no variable which counts the number of free swap buffers like before. So, once all the buffers were used, we try to move all the unlocked buffers to the free list at once. If we couldn't move even one, them we wait for one page to have its IO finished and go get this swap buffer. Our old code didn't perform this task so efficiently. For example, everytime we had a free fragment, we checked all the fragments to see if they were locked. With a used list we avoid this kind of overhead. - swap_out_fragments() was rewritten too. Part of the code was moved to decompress_to_swp_buffer() function. Since we don't have to worry about Freed bit, the code is much simpler. - find_*_comp_cache() functions don't have special cases for Freed fragments. - once there's no variable number_of_free_swp_buffers and we don't hold a referente to the swap entry in swap_out_fragments(), there's no need to update swap buffers in end_buffer_io_async(). --- buffer.c DELETED --- |