lkml.org 
[lkml]   [2006]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[Suspend2][ 04/35] [Suspend2] Does a filewriter page have contiguous blocks?
    Date
    To simplify things, pages in the file being used by the filewriter which
    don't have contiguous blocks are ignored. This function determines whether
    a given page meets this criteria by bmapping each sector in the page to
    check.

    Signed-off-by: Nigel Cunningham <nigel@suspend2.net>

    kernel/power/suspend_file.c | 18 ++++++++++++++++++
    1 files changed, 18 insertions(+), 0 deletions(-)

    diff --git a/kernel/power/suspend_file.c b/kernel/power/suspend_file.c
    index caa86bc..41aaed4 100644
    --- a/kernel/power/suspend_file.c
    +++ b/kernel/power/suspend_file.c
    @@ -136,3 +136,21 @@ static int filewriter_storage_available(
    return result;
    }

    +static int has_contiguous_blocks(int page_num)
    +{
    + int j;
    + sector_t last = 0;
    +
    + for (j = 0; j < devinfo.blocks_per_page; j++) {
    + sector_t this = bmap(target_inode,
    + page_num * devinfo.blocks_per_page + j);
    +
    + if (!this || (last && (last + 1) != this))
    + break;
    +
    + last = this;
    + }
    +
    + return (j == devinfo.blocks_per_page);
    +}
    +
    --
    Nigel Cunningham nigel at suspend2 dot net
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2006-06-27 01:06    [W:0.042 / U:1.808 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site