All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] debugfs: allow do_write() to handle files over 4GB
@ 2014-07-24 23:49 Andreas Dilger
  2014-07-25  0:04 ` Darrick J. Wong
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Dilger @ 2014-07-24 23:49 UTC (permalink / raw)
  To: tytso; +Cc: linux-ext4, Andreas Dilger

Fix debugfs do_write() to correctly set i_size_high if the source
file is larger than 4GB.  Otherwise, only the low 32 bits of the
size is stored in i_size.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
---
 debugfs/debugfs.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
index 1703aba..1184596 100644
--- a/debugfs/debugfs.c
+++ b/debugfs/debugfs.c
@@ -1719,6 +1719,8 @@ void do_write(int argc, char *argv[])
 		current_fs->now ? current_fs->now : time(0);
 	inode.i_links_count = 1;
 	inode.i_size = statbuf.st_size;
+	/* cast to (long long) to avoid shift warning if st_size is 32 bits */
+	inode.i_size_high = (long long)statbuf.st_size >> 32;
 	if (current_fs->super->s_feature_incompat &
 	    EXT3_FEATURE_INCOMPAT_EXTENTS) {
 		int i;
-- 
1.7.3.4


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

* Re: [PATCH] debugfs: allow do_write() to handle files over 4GB
  2014-07-24 23:49 [PATCH] debugfs: allow do_write() to handle files over 4GB Andreas Dilger
@ 2014-07-25  0:04 ` Darrick J. Wong
  2014-07-26 18:40   ` Theodore Ts'o
  0 siblings, 1 reply; 3+ messages in thread
From: Darrick J. Wong @ 2014-07-25  0:04 UTC (permalink / raw)
  To: Andreas Dilger; +Cc: tytso, linux-ext4

On Thu, Jul 24, 2014 at 05:49:19PM -0600, Andreas Dilger wrote:
> Fix debugfs do_write() to correctly set i_size_high if the source
> file is larger than 4GB.  Otherwise, only the low 32 bits of the
> size is stored in i_size.

You might also want to set large_file if needed.  I wrote a helper to set an
inode's i_size* fields and turn on feature bits; it's been languishing at the
back end of the patchbomb for a while:
http://permalink.gmane.org/gmane.comp.file-systems.ext4/43861

--D

> 
> Signed-off-by: Andreas Dilger <adilger@dilger.ca>
> ---
>  debugfs/debugfs.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
> index 1703aba..1184596 100644
> --- a/debugfs/debugfs.c
> +++ b/debugfs/debugfs.c
> @@ -1719,6 +1719,8 @@ void do_write(int argc, char *argv[])
>  		current_fs->now ? current_fs->now : time(0);
>  	inode.i_links_count = 1;
>  	inode.i_size = statbuf.st_size;
> +	/* cast to (long long) to avoid shift warning if st_size is 32 bits */
> +	inode.i_size_high = (long long)statbuf.st_size >> 32;
>  	if (current_fs->super->s_feature_incompat &
>  	    EXT3_FEATURE_INCOMPAT_EXTENTS) {
>  		int i;
> -- 
> 1.7.3.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] debugfs: allow do_write() to handle files over 4GB
  2014-07-25  0:04 ` Darrick J. Wong
@ 2014-07-26 18:40   ` Theodore Ts'o
  0 siblings, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2014-07-26 18:40 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Andreas Dilger, linux-ext4

On Thu, Jul 24, 2014 at 05:04:31PM -0700, Darrick J. Wong wrote:
> On Thu, Jul 24, 2014 at 05:49:19PM -0600, Andreas Dilger wrote:
> > Fix debugfs do_write() to correctly set i_size_high if the source
> > file is larger than 4GB.  Otherwise, only the low 32 bits of the
> > size is stored in i_size.
> 
> You might also want to set large_file if needed.  I wrote a helper to set an
> inode's i_size* fields and turn on feature bits; it's been languishing at the
> back end of the patchbomb for a while:
> http://permalink.gmane.org/gmane.comp.file-systems.ext4/43861

I've pulled in a slightly modified version of Darrick's patch, which
takes care of this issue.

							- Ted

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

end of thread, other threads:[~2014-07-26 18:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-24 23:49 [PATCH] debugfs: allow do_write() to handle files over 4GB Andreas Dilger
2014-07-25  0:04 ` Darrick J. Wong
2014-07-26 18:40   ` Theodore Ts'o

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.