fs/buffer.c: call __block_write_begin() if we have page
authorNamhyung Kim <namhyung@gmail.com>
Mon, 25 Oct 2010 06:01:12 +0000 (15:01 +0900)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 26 Oct 2010 01:18:23 +0000 (21:18 -0400)
If we have the appropriate page already, call __block_write_begin()
directly instead of releasing and regrabbing it inside of
block_write_begin().

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/buffer.c

index 74566c6f67b17816dc89c78be8a26d1507454e74..d895d9fd5b715ca1405c35cc47d42ec489c09aa5 100644 (file)
@@ -2458,11 +2458,10 @@ int nobh_write_begin(struct address_space *mapping,
        *fsdata = NULL;
 
        if (page_has_buffers(page)) {
-               unlock_page(page);
-               page_cache_release(page);
-               *pagep = NULL;
-               return block_write_begin(mapping, pos, len, flags, pagep,
-                                        get_block);
+               ret = __block_write_begin(page, pos, len, get_block);
+               if (unlikely(ret))
+                       goto out_release;
+               return ret;
        }
 
        if (PageMappedToDisk(page))