Re: 2.6.9-mm1: LVM stopped working (dio-handle-eof.patch)

From: Valdis . Kletnieks
Date: Fri Nov 05 2004 - 11:04:46 EST


On Tue, 02 Nov 2004 15:55:41 +0100, Jens Axboe said:

> Ehm, that should be
>
> if ((isize - offset))
> bytes_todo = isize - offset;
> else if (bytes_todo > PAGE_SIZE)
> bytes_todo = PAGE_SIZE;

(Sorry for delay in testing this one...)

This version fixes my LVM issues on 2.6.10-rc1-mm2 as well...

>
> --- /opt/kernel/linux-2.6.10-rc1-mm1/fs/direct-io.c 2004-10-27 08:29:51.000
000000 +0200
> +++ linux-2.6.10-rc1-mm1/fs/direct-io.c 2004-11-02 15:55:27.918459070 +
0100
> @@ -985,10 +985,12 @@
> }
>
> isize = i_size_read(inode);
> - if (bytes_todo > (isize - offset))
> - bytes_todo = isize - offset;
> - if (!bytes_todo)
> - return 0;
> + if (bytes_todo > (isize - offset)) {
> + if ((isize - offset))
> + bytes_todo = isize - offset;
> + else if (bytes_todo > PAGE_SIZE)
> + bytes_todo = PAGE_SIZE;
> + }
>
> for (seg = 0; seg < nr_segs && bytes_todo; seg++) {
> user_addr = (unsigned long)iov[seg].iov_base;
> @@ -1008,10 +1010,9 @@
> dio->curr_page = 0;
>
> dio->total_pages = 0;
> - if (user_addr & (PAGE_SIZE-1)) {
> + if (user_addr & (PAGE_SIZE-1))
> dio->total_pages++;
> - bytes -= PAGE_SIZE - (user_addr & (PAGE_SIZE - 1));
> - }
> +
> dio->total_pages += (bytes + PAGE_SIZE - 1) / PAGE_SIZE;
> dio->curr_user_address = user_addr;
>
>
> --
> Jens Axboe
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>

Attachment: pgp00000.pgp
Description: PGP signature