[Yaffs] YAFFS1 return zero for success in commit_write

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Todd Poynor
Date:  
To: yaffs
Subject: [Yaffs] YAFFS1 return zero for success in commit_write
Some callers to block-layer commit_write function treat non-zero
return as error, notably the loopback mount driver sometimes used in
conjunction with YAFFS on NAND flash for bad block avoidance, etc.
Return zero for success as do various other commit_write functions.

Signed-off-by: Todd Poynor <>

Index: yaffs_fs.c
===================================================================
RCS file: /home/aleph1/cvs/yaffs/yaffs_fs.c,v
retrieving revision 1.41
diff -u -r1.41 yaffs_fs.c
--- yaffs_fs.c    11 Oct 2005 23:43:27 -0000    1.41
+++ yaffs_fs.c    19 Oct 2005 03:04:34 -0000
@@ -596,9 +596,9 @@
         SetPageUptodate(pg);
     }


-    T(YAFFS_TRACE_OS,("yaffs_commit_write returning %d\n",nWritten));
-    
-    return nWritten;
+    T(YAFFS_TRACE_OS,("yaffs_commit_write returning %d\n",nWritten == nBytes ? 0 : -1));
+
+    return nWritten == nBytes ? 0 : -1;


}