LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] FAT: DIO-write fallback to normal buffered
       [not found] <87sldenkg0.fsf@duaron.myhome.or.jp>
@ 2007-02-10 14:44 ` OGAWA Hirofumi
  2007-02-14 10:55   ` Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: OGAWA Hirofumi @ 2007-02-10 14:44 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Jan Kara, linux-kernel

[RESEND: forget to add linux-kernel@vger.kernel.org]

If the DIO write on FAT is expanding the size, it will be fail by -EINVAL,
because FAT can't handle it now.

This patch fallback it to the normal buffered-write and would return
success.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
---

 fs/fat/inode.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff -puN fs/fat/inode.c~fat_direct-io-fallback fs/fat/inode.c
--- linux-2.6/fs/fat/inode.c~fat_direct-io-fallback	2007-02-10 22:08:33.000000000 +0900
+++ linux-2.6-hirofumi/fs/fat/inode.c	2007-02-10 22:08:33.000000000 +0900
@@ -173,10 +173,12 @@ static ssize_t fat_direct_IO(int rw, str
 		 *
 		 * But we must fill the remaining area or hole by nul for
 		 * updating ->mmu_private.
+		 *
+		 * Return 0, and fallback to normal buffered write.
 		 */
 		loff_t size = offset + iov_length(iov, nr_segs);
 		if (MSDOS_I(inode)->mmu_private < size)
-			return -EINVAL;
+			return 0;
 	}
 
 	/*
_

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] FAT: DIO-write fallback to normal buffered
  2007-02-10 14:44 ` [PATCH] FAT: DIO-write fallback to normal buffered OGAWA Hirofumi
@ 2007-02-14 10:55   ` Jan Kara
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2007-02-14 10:55 UTC (permalink / raw)
  To: OGAWA Hirofumi; +Cc: Andrew Morton, linux-kernel

On Sat 10-02-07 23:44:01, OGAWA Hirofumi wrote:
> [RESEND: forget to add linux-kernel@vger.kernel.org]
> 
> If the DIO write on FAT is expanding the size, it will be fail by -EINVAL,
> because FAT can't handle it now.
> 
> This patch fallback it to the normal buffered-write and would return
> success.
> 
> Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
  Signed-off-by: Jan Kara <jack@suse.cz>

  Just to explain a bit: I think that returning EINVAL is quite unexpected
for users in this case (I actually got a bugreport which turned out to be
this problem) and fallback to buffered IO seems to be a reasonable thing to
do. Probably it's not the cleanest solution but for FAT I think it's good
enough ;).

								Honza

> ---
> 
>  fs/fat/inode.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff -puN fs/fat/inode.c~fat_direct-io-fallback fs/fat/inode.c
> --- linux-2.6/fs/fat/inode.c~fat_direct-io-fallback	2007-02-10 22:08:33.000000000 +0900
> +++ linux-2.6-hirofumi/fs/fat/inode.c	2007-02-10 22:08:33.000000000 +0900
> @@ -173,10 +173,12 @@ static ssize_t fat_direct_IO(int rw, str
>  		 *
>  		 * But we must fill the remaining area or hole by nul for
>  		 * updating ->mmu_private.
> +		 *
> +		 * Return 0, and fallback to normal buffered write.
>  		 */
>  		loff_t size = offset + iov_length(iov, nr_segs);
>  		if (MSDOS_I(inode)->mmu_private < size)
> -			return -EINVAL;
> +			return 0;
>  	}
>  
>  	/*
> _
-- 
Jan Kara <jack@suse.cz>
SuSE CR Labs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-02-14 10:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <87sldenkg0.fsf@duaron.myhome.or.jp>
2007-02-10 14:44 ` [PATCH] FAT: DIO-write fallback to normal buffered OGAWA Hirofumi
2007-02-14 10:55   ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).