public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chris Mason <mason@suse.com>
To: reiserfs-list@namesys.com, linux-kernel@vger.kernel.org
Subject: [PATCH] reiserfs lfs fix for 2.4.4-pre5 and above
Date: Wed, 25 Apr 2001 19:12:12 -0400	[thread overview]
Message-ID: <494520000.988240332@tiny> (raw)


Hello everyone,

2.4.4-pre5 started honoring the s_maxbytes field, so reiserfs needs a 
patch to allow files > 4GB on 3.6.x format filesystems.

If you work with large files on reiserfs and are willing to try
the prerelease kernels (non-production), please give this a try, 
it works for me but I'd like a few confirmations before I send to Linus.

This also prevents someone from using truncate to expand an old 
format file past the 2GB mark.

-chris

diff -Nru a/fs/reiserfs/file.c b/fs/reiserfs/file.c
--- a/fs/reiserfs/file.c	Tue Apr 24 13:37:21 2001
+++ b/fs/reiserfs/file.c	Tue Apr 24 13:37:21 2001
@@ -106,6 +106,24 @@
   return ( n_err < 0 ) ? -EIO : 0;
 }
 
+static int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) {
+    struct inode *inode = dentry->d_inode ;
+    int error ;
+    if (attr->ia_valid & ATTR_SIZE) {
+	/* version 2 items will be caught by the s_maxbytes check
+	** done for us in vmtruncate
+	*/
+        if (inode_items_version(inode) == ITEM_VERSION_1 && 
+	    attr->ia_size > MAX_NON_LFS)
+            return -EFBIG ;
+    }
+
+    error = inode_change_ok(inode, attr) ;
+    if (!error)
+        inode_setattr(inode, attr) ;
+
+    return error ;
+}
 
 struct file_operations reiserfs_file_operations = {
     read:	generic_file_read,
@@ -119,6 +137,7 @@
 
 struct  inode_operations reiserfs_file_inode_operations = {
     truncate:	reiserfs_vfs_truncate_file,
+    setattr:    reiserfs_setattr,
 };
 
 
diff -Nru a/fs/reiserfs/super.c b/fs/reiserfs/super.c
--- a/fs/reiserfs/super.c	Tue Apr 24 13:37:21 2001
+++ b/fs/reiserfs/super.c	Tue Apr 24 13:37:21 2001
@@ -492,7 +492,11 @@
     SB_BUFFER_WITH_SB (s) = bh;
     SB_DISK_SUPER_BLOCK (s) = rs;
     s->s_op = &reiserfs_sops;
-    s->s_maxbytes = 0xFFFFFFFF;	/* 4Gig */
+
+    /* new format is limited by the 32 bit wide i_blocks field, want to
+    ** be one full block below that.
+    */
+    s->s_maxbytes = (512LL << 32) - s->s_blocksize ;
     return 0;
 }
 



                 reply	other threads:[~2001-04-25 23:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=494520000.988240332@tiny \
    --to=mason@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=reiserfs-list@namesys.com \
    /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