• Badari Pulavarty's avatar
    [PATCH] DIO pages-in-io accounting fix · 17ccf8a6
    Badari Pulavarty authored
    I found one more accounting inconsistency with dio_pages_in_io.  This is a
    day-one bug and I started hitting it on latest -mm due to the recent
    changes to dio_pages_in_io calculations to be exact.
    
    If the file is badly fragmented (no contiguous blocks at all), and the user
    buffer is not page aligned - we need to create IO for each disk block with
    2 pages.  (bio with 2 vecs).
    
    dio_bio_add_page() should not decrement dio_pages_in_io for every add page.
     It should only decrement, it only if its done with that page and moving on
    to next page.  (since dio_pages_in_io represent how many actual pages we
    are operating on).
    
    Here is the patch to fix this accounting.  Without this patch, we will hit
    BUG() in dio_new_bio() with O_DIRECT on filesystems.
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    17ccf8a6
direct-io.c 32.3 KB