Whamcloud - gitweb
b=1776
authorphil <phil>
Sat, 16 Aug 2003 18:50:24 +0000 (18:50 +0000)
committerphil <phil>
Sat, 16 Aug 2003 18:50:24 +0000 (18:50 +0000)
r=shaver
Change the read_record and write_record APIs to return 0 on success
and a negative error.  Any short read/write is reported as -EIO.

It used to return the number of bytes completed, which meant that the
error checking code had to be duplicated everywhere.  A short I/O in
either of these functions is always a failure.

(As a nice side effect, one of the orphan functions got this wrong, so
this gets us somewhat closer to having that infrastructure)

lustre/obdclass/fsfilt_ext3.c

index c10d9cb..b552935 100644 (file)
@@ -555,7 +555,7 @@ static int fsfilt_ext3_read_record(struct file * file, void *buf,
         memcpy(buf, bh->b_data + boffs, size);
         brelse(bh);
         *offs += size;
-        return size;
+        return 0;
 }
 
 static int fsfilt_ext3_write_record(struct file *file, void *buf, int size,
@@ -617,7 +617,6 @@ static int fsfilt_ext3_write_record(struct file *file, void *buf, int size,
                 CERROR("journal_dirty_metadata() returned error %d\n", err);
                 goto out;
         }
-        err = size;
 
         if (force_sync)
                 handle->h_sync = 1; /* recovery likes this */
@@ -625,7 +624,7 @@ out:
         if (bh)
                 brelse(bh);
         journal_stop(handle);
-        if (err > 0)
+        if (err == 0)
                 *offs += size;
         return err;
 }