From 9a5d68567513b06d41def6c700eaeabb1c9cb6d5 Mon Sep 17 00:00:00 2001 From: adilger Date: Wed, 12 Jun 2002 19:20:00 +0000 Subject: [PATCH] Part of the O_DIRECT fix. The page indices iobuf->maplist[i]->index do not appear to contain valid offsets into the file. Use the "blocknr" value per generic_direct_IO instead. --- lustre/llite/rw.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index 588c95e..9f09ba3 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -288,15 +288,23 @@ int ll_direct_IO(int rw, struct inode *inode, struct kiobuf *iobuf, ENTRY; + if (blocksize != PAGE_SIZE) { + CERROR("direct_IO blocksize != PAGE_SIZE, what to do?\n"); + LBUG(); + } + OBD_ALLOC(count, sizeof(obd_size) * bufs_per_obdo); OBD_ALLOC(offset, sizeof(obd_off) * bufs_per_obdo); OBD_ALLOC(flags, sizeof(obd_flag) * bufs_per_obdo); if (!count || !offset || !flags) GOTO(out, rc = -ENOMEM); - for (i = 0 ; i < bufs_per_obdo ; i++) { + /* NB: we can't use iobuf->maplist[i]->index for the offset + * instead of "blocknr" because ->index contains garbage. + */ + for (i = 0; i < bufs_per_obdo; i++, blocknr++) { count[i] = PAGE_SIZE; - offset[i] = ((obd_off)(iobuf->maplist[i])->index) << PAGE_SHIFT; + offset[i] = (obd_off)blocknr << PAGE_SHIFT; flags[i] = OBD_BRW_CREATE; } -- 1.8.3.1