]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - fs/hfsplus/inode.c
get rid of cont_write_begin_newtrunc
[mv-sheeva.git] / fs / hfsplus / inode.c
index 48602177391116c5c55357c5d7077e9fc67a366b..88bf1b562641383e514e41ffa8941b327f913abb 100644 (file)
@@ -31,10 +31,19 @@ static int hfsplus_write_begin(struct file *file, struct address_space *mapping,
                        loff_t pos, unsigned len, unsigned flags,
                        struct page **pagep, void **fsdata)
 {
+       int ret;
+
        *pagep = NULL;
-       return cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata,
+       ret = cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata,
                                hfsplus_get_block,
                                &HFSPLUS_I(mapping->host).phys_size);
+       if (unlikely(ret)) {
+               loff_t isize = mapping->host->i_size;
+               if (pos + len > isize)
+                       vmtruncate(mapping->host, isize);
+       }
+
+       return ret;
 }
 
 static sector_t hfsplus_bmap(struct address_space *mapping, sector_t block)