mtd/fs/jffs2 file.c,1.97,1.98
David Woodhouse
dwmw2 at infradead.org
Fri Mar 19 11:41:12 EST 2004
Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv14151
Modified Files:
file.c
Log Message:
Align start of write to 4-byte boundary
Index: file.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/file.c,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -r1.97 -r1.98
--- file.c 2 Nov 2003 08:52:35 -0000 1.97
+++ file.c 19 Mar 2004 16:41:09 -0000 1.98
@@ -207,6 +207,7 @@
struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
struct jffs2_raw_inode *ri;
+ unsigned aligned_start = start & ~3;
int ret = 0;
uint32_t writtenlen = 0;
@@ -240,9 +241,9 @@
hurt to do it again. The alternative is ifdefs, which are ugly. */
kmap(pg);
- ret = jffs2_write_inode_range(c, f, ri, page_address(pg) + start,
- (pg->index << PAGE_CACHE_SHIFT) + start,
- end - start, &writtenlen);
+ ret = jffs2_write_inode_range(c, f, ri, page_address(pg) + aligned_start,
+ (pg->index << PAGE_CACHE_SHIFT) + aligned_start,
+ end - aligned_start, &writtenlen);
kunmap(pg);
@@ -250,6 +251,12 @@
/* There was an error writing. */
SetPageError(pg);
}
+
+ /* Adjust writtenlen for the padding we did, so we don't confuse our caller */
+ if (writtenlen < (start&3))
+ writtenlen = 0;
+ else
+ writtenlen -= (start&3);
if (writtenlen) {
if (inode->i_size < (pg->index << PAGE_CACHE_SHIFT) + start + writtenlen) {
More information about the linux-mtd-cvs
mailing list