mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 7/6] fat: Support a truncate() for expanding size
Date: Mon, 7 Nov 2005 20:19:34 -0800	[thread overview]
Message-ID: <20051107201934.4c01a472.akpm@osdl.org> (raw)
In-Reply-To: <87ek5rx1ur.fsf@devron.myhome.or.jp>

OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> wrote:
>
> Andrew Morton <akpm@osdl.org> writes:
> 
> > OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> 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.
_


  reply	other threads:[~2005-11-08  4:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-07 17:32 [PATCH 1/6] fat: move fat_clusters_flush() to write_super() OGAWA Hirofumi
2005-11-07 17:36 ` [PATCH] fat: use sb_find_get_block() instead of sb_getblk() OGAWA Hirofumi
2005-11-07 17:37   ` [PATCH 3/6] fat: add the read/writepages() OGAWA Hirofumi
2005-11-07 17:39     ` [PATCH 4/6] fat: s/EXPORT_SYMBOL/EXPORT_SYMBOL_GPL/ OGAWA Hirofumi
2005-11-07 17:41       ` [PATCH 5/6] fat: support ->direct_IO() OGAWA Hirofumi
2005-11-07 17:42         ` [PATCH 6/6] export/change sync_page_range/_nolock() OGAWA Hirofumi
2005-11-07 17:46           ` [PATCH 7/6] fat: Support a truncate() for expanding size OGAWA Hirofumi
2005-11-07 17:51             ` OGAWA Hirofumi
2005-11-08  1:06             ` Andrew Morton
2005-11-08  3:19               ` OGAWA Hirofumi
2005-11-08  4:19                 ` Andrew Morton [this message]
2005-11-08  5:22                   ` OGAWA Hirofumi
2005-11-08 20:40                     ` OGAWA Hirofumi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051107201934.4c01a472.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome