OGAWA Hirofumi <[email protected]> wrote:
>
> Andrew Morton <[email protected]> writes:
>
> > OGAWA Hirofumi <[email protected]> wrote:
> >>
> >> +static int fat_cont_expand(struct inode *inode, loff_t size)
> >
> > Is it not possible to extend generic_cont_expand() so that fatfs can use it?
>
> The generic_cont_expand() is too generic.
But can it be fixed??
> If "size" is block boundary, generic_cont_expand() expands the
> ->i_size to "size + 1", after it, the caller of it will truncate to
> "size" by vmtruncate().
Something like this?
--- devel/fs/buffer.c~a 2005-11-07 20:17:49.000000000 -0800
+++ devel-akpm/fs/buffer.c 2005-11-07 20:18:59.000000000 -0800
@@ -2160,7 +2160,7 @@ int block_read_full_page(struct page *pa
* truncates. Uses prepare/commit_write to allow the filesystem to
* deal with the hole.
*/
-int generic_cont_expand(struct inode *inode, loff_t size)
+static int __generic_cont_expand(struct inode *inode, loff_t size, int dont_do_that)
{
struct address_space *mapping = inode->i_mapping;
struct page *page;
@@ -2182,9 +2182,8 @@ int generic_cont_expand(struct inode *in
** skip the prepare. make sure we never send an offset for the start
** of a block
*/
- if ((offset & (inode->i_sb->s_blocksize - 1)) == 0) {
+ if (!dont_do_that && (offset & (inode->i_sb->s_blocksize - 1)) == 0)
offset++;
- }
index = size >> PAGE_CACHE_SHIFT;
err = -ENOMEM;
page = grab_cache_page(mapping, index);
@@ -2202,6 +2201,16 @@ out:
return err;
}
+int generic_cont_expand(struct inode *inode, loff_t size)
+{
+ return __generic_cont_expand(inode, size, 0);
+}
+
+int generic_cont_expand_dont_do_that(struct inode *inode, loff_t size)
+{
+ return __generic_cont_expand(inode, size, 1);
+}
+
/*
* For moronic filesystems that do not allow holes in file.
* We may have to extend the file.
_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]