Re: [PATCH] zero_user_page uses in fs/buffer.c and fs/libfs.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 1 May 2007, Nate Diller wrote:

> well, leave it to me to reply too quickly, sorry.  i think we should
> leave simple_prepare_write() the way it is, since it's a library
> function itself.  the other two callsites in your patch are buffers,
> which may themselves be smaller than a page so you would need a
> special function for just those two uses, there's no other way to
> avoid making two calls to flush_dcache_page().  if it's tremendously
> important to you to eliminate open coding of these, maybe make a
> 'static int buffer_prepare_write()' or some such in fs/buffer.c

All three sites zap two parts of a page. If we had a 
zero_user_page2 like this

zero_user_page2(page, start1, end1, start2, end2, kmap)

then all 3 sites could use the same funtion.

libfs.c:

zero_user_page_segments(page, 0, from, to, PAGE_CACHE_SIZE, KM_USER0);

buffer.c:

zero_user_page_segments(page, from, block_start, to, block_end, KM_USER0)

zero_user_page_segments(page, blockstart, from, to, block_end, KM_USER0)


I did not look through the whole kernel but this zapping segments is 
likely frequent given the nature of the blocklayer.

The 3 call sites pretty ugly on their own. I think it would be good 
to have one clearly commented version of this somewhere. Call sites
will be much clearer since you do not have the kmap_ obfuscation nor
the calculation of the length of each segment.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux