From 3ead3052f940109955db7c5b5499ceb34e7c6ebf Mon Sep 17 00:00:00 2001 From: phil Date: Sat, 16 Aug 2003 18:50:24 +0000 Subject: [PATCH] b=1776 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 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lustre/obdclass/fsfilt_ext3.c b/lustre/obdclass/fsfilt_ext3.c index c10d9cbd..b552935 100644 --- a/lustre/obdclass/fsfilt_ext3.c +++ b/lustre/obdclass/fsfilt_ext3.c @@ -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; } -- 1.8.3.1