lkml.org 
[lkml]   [2010]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 13/23] Hibernation: Partial page I/O support.
    Hi!

    > Add functions that can be used for coalescing and splitting buffers
    > that are smaller than PAGE_SIZE. These functions provide no method
    > of determining where the boundaries of the smaller buffers are to
    > be found - that is the caller's problem.

    I don't get it; why do we need that support?


    > +int hib_write_buffer(char *buffer, int buffer_size)
    > +{
    > + int bytes_left = buffer_size, result = 0;
    > +
    > + while (bytes_left) {
    > + char *from = buffer + buffer_size - bytes_left;
    > + char *to = hib_ppio_buffer + hib_ppio_buffer_posn;
    > + int capacity = PAGE_SIZE - hib_ppio_buffer_posn;
    > +
    > + if (bytes_left <= capacity) {
    > + memcpy(to, from, bytes_left);
    > + hib_ppio_buffer_posn += bytes_left;
    > + return 0;
    > + }
    > +
    > + /* Complete this page and start a new one */
    > + memcpy(to, from, capacity);
    > + bytes_left -= capacity;

    If this copy happens too often, it will slow stuff down...
    --
    (english) http://www.livejournal.com/~pavelmachek
    (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


    \
     
     \ /
      Last update: 2010-10-13 15:07    [W:2.660 / U:0.332 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site