UBIFS: fix assertion warning and refine comments
[pandora-kernel.git] / fs / ubifs / file.c
index d77db7e..28be1e6 100644 (file)
@@ -448,10 +448,12 @@ static int ubifs_write_begin(struct file *file, struct address_space *mapping,
                if (!(pos & ~PAGE_CACHE_MASK) && len == PAGE_CACHE_SIZE) {
                        /*
                         * We change whole page so no need to load it. But we
-                        * have to set the @PG_checked flag to make the further
-                        * code know that the page is new. This might be not
-                        * true, but it is better to budget more than to read
-                        * the page from the media.
+                        * do not know whether this page exists on the media or
+                        * not, so we assume the latter because it requires
+                        * larger budget. The assumption is that it is better
+                        * to budget a bit more than to read the page from the
+                        * media. Thus, we are setting the @PG_checked flag
+                        * here.
                         */
                        SetPageChecked(page);
                        skipped_read = 1;
@@ -559,6 +561,7 @@ static int ubifs_write_end(struct file *file, struct address_space *mapping,
                dbg_gen("copied %d instead of %d, read page and repeat",
                        copied, len);
                cancel_budget(c, page, ui, appending);
+               ClearPageChecked(page);
 
                /*
                 * Return 0 to force VFS to repeat the whole operation, or the