Skip to contentSkip to conversation

change of cont_prepare_write() for the large file

RFC New OGAWA Hirofumi 1 participant 1 message Jun 26, 2002

Subsystems (2)
lore
Share & tools
lore

OGAWA Hirofumi

author maintainer
#0 lore raw

RFC 1/1 change of cont_prepare_write() for the large file

Hi,

I'm going to change the cont_prepare_write() for support of 4G - 1 file on FAT32. And the following change break the adfs/affs/hfs/hpfs/qnx4.

fs/buffer.c +1 -1
diff -urN linux-2.5.24/fs/buffer.c fat_big-file-2.5.24/fs/buffer.c
@@ -1930,7 +1930,7 @@
  */
 
 int cont_prepare_write(struct page *page, unsigned offset,
-		unsigned to, get_block_t *get_block, unsigned long *bytes)
+		unsigned to, get_block_t *get_block, loff_t *bytes)
 {
 	struct address_space *mapping = page->mapping;
 	struct inode *inode = mapping->host;

The attached patch fixes those fs. If no problem, I'll submit patches at this weekend.

Please review. Thanks.

Signature · 1 line
OGAWA Hirofumi <[email protected]>
fs/buffer.c +1 -1
diff -urN linux-2.5.24/fs/buffer.c fat_big-file-2.5.24/fs/buffer.c
@@ -1930,7 +1930,7 @@
  */
 
 int cont_prepare_write(struct page *page, unsigned offset,
-		unsigned to, get_block_t *get_block, unsigned long *bytes)
+		unsigned to, get_block_t *get_block, loff_t *bytes)
 {
 	struct address_space *mapping = page->mapping;
 	struct inode *inode = mapping->host;
fs/fat/file.c +1 -1
diff -urN linux-2.5.24/fs/fat/file.c fat_big-file-2.5.24/fs/fat/file.c
@@ -54,7 +54,7 @@
 	}
 	if (!create)
 		return 0;
-	if (iblock << sb->s_blocksize_bits != MSDOS_I(inode)->mmu_private) {
+	if (iblock != MSDOS_I(inode)->mmu_private >> sb->s_blocksize_bits) {
 		BUG();
 		return -EIO;
 	}
fs/fat/inode.c +4 -2
diff -urN linux-2.5.24/fs/fat/inode.c fat_big-file-2.5.24/fs/fat/inode.c
@@ -417,7 +417,7 @@
 	}
 	inode->i_blksize = 1 << sbi->cluster_bits;
 	inode->i_blocks = ((inode->i_size + inode->i_blksize - 1)
-			   & ~(inode->i_blksize - 1)) >> 9;
+			   & ~((loff_t)inode->i_blksize - 1)) >> 9;
 	MSDOS_I(inode)->i_logstart = 0;
 	MSDOS_I(inode)->mmu_private = inode->i_size;
 
@@ -775,6 +775,8 @@
 		sbi->fat_length = CF_LE_L(b->fat32_length);
 		sbi->root_cluster = CF_LE_L(b->root_cluster);
 
+		sb->s_maxbytes = 0xffffffff;
+		
 		/* MC - if info_sector is 0, don't multiply by 0 */
 		sbi->fsinfo_sector = CF_LE_W(b->info_sector);
 		if (sbi->fsinfo_sector == 0)
@@ -1063,7 +1065,7 @@
 	/* this is as close to the truth as we can get ... */
 	inode->i_blksize = 1 << sbi->cluster_bits;
 	inode->i_blocks = ((inode->i_size + inode->i_blksize - 1)
-			   & ~(inode->i_blksize - 1)) >> 9;
+			   & ~((loff_t)inode->i_blksize - 1)) >> 9;
 	inode->i_mtime = inode->i_atime =
 		date_dos2unix(CF_LE_W(de->time),CF_LE_W(de->date));
 	inode->i_ctime =
include/linux/buffer_head.h +1 -1
diff -urN linux-2.5.24/include/linux/buffer_head.h fat_big-file-2.5.24/include/linux/buffer_head.h
@@ -180,7 +180,7 @@
 int block_read_full_page(struct page*, get_block_t*);
 int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*);
 int cont_prepare_write(struct page*, unsigned, unsigned, get_block_t*,
-				unsigned long *);
+				loff_t *);
 int generic_cont_expand(struct inode *inode, loff_t size) ;
 int block_commit_write(struct page *page, unsigned from, unsigned to);
 int block_sync_page(struct page *);
include/linux/msdos_fs_i.h +1 -1
diff -urN linux-2.5.24/include/linux/msdos_fs_i.h fat_big-file-2.5.24/include/linux/msdos_fs_i.h
@@ -8,7 +8,7 @@
  */
 
 struct msdos_inode_info {
-	unsigned long mmu_private;
+	loff_t mmu_private;
 	int i_start;	/* first cluster or 0 */
 	int i_logstart;	/* logical first cluster */
 	int i_attrs;	/* unused attribute bits */
include/linux/adfs_fs_i.h +1 -1
diff -urN fat_big-file-2.5.24/include/linux/adfs_fs_i.h mmu_private-fix-2.5.24/include/linux/adfs_fs_i.h
@@ -11,7 +11,7 @@
  * adfs file system inode data in memory
  */
 struct adfs_inode_info {
-	unsigned long	mmu_private;
+	loff_t		mmu_private;
 	unsigned long	parent_id;	/* object id of parent		*/
 	__u32		loadaddr;	/* RISC OS load address		*/
 	__u32		execaddr;	/* RISC OS exec address		*/
include/linux/affs_fs_i.h +1 -1
diff -urN fat_big-file-2.5.24/include/linux/affs_fs_i.h mmu_private-fix-2.5.24/include/linux/affs_fs_i.h
@@ -35,7 +35,7 @@
 	struct affs_ext_key *i_ac;		/* associative cache of extended blocks */
 	u32	 i_ext_last;			/* last accessed extended block */
 	struct buffer_head *i_ext_bh;		/* bh of last extended block */
-	unsigned long mmu_private;
+	loff_t	 mmu_private;
 	u32	 i_protect;			/* unused attribute bits */
 	u32	 i_lastalloc;			/* last allocated block */
 	int	 i_pa_cnt;			/* number of preallocated blocks */
include/linux/hfs_fs_i.h +1 -1
diff -urN fat_big-file-2.5.24/include/linux/hfs_fs_i.h mmu_private-fix-2.5.24/include/linux/hfs_fs_i.h
@@ -19,7 +19,7 @@
 struct hfs_inode_info {
 	int				magic;     /* A magic number */
 
-	unsigned long			mmu_private;
+	loff_t				mmu_private;
 	struct hfs_cat_entry		*entry;
 
 	/* For a regular or header file */
include/linux/hpfs_fs_i.h +1 -1
diff -urN fat_big-file-2.5.24/include/linux/hpfs_fs_i.h mmu_private-fix-2.5.24/include/linux/hpfs_fs_i.h
@@ -2,7 +2,7 @@
 #define _HPFS_FS_I
 
 struct hpfs_inode_info {
-	unsigned long mmu_private;
+	loff_t mmu_private;
 	ino_t i_parent_dir;	/* (directories) gives fnode of parent dir */
 	unsigned i_dno;		/* (directories) root dnode */
 	unsigned i_dpos;	/* (directories) temp for readdir */
include/linux/qnx4_fs.h +1 -1
diff -urN fat_big-file-2.5.24/include/linux/qnx4_fs.h mmu_private-fix-2.5.24/include/linux/qnx4_fs.h
@@ -106,7 +106,7 @@
 
 struct qnx4_inode_info {
 	struct qnx4_inode_entry raw;
-	unsigned long mmu_private;
+	loff_t mmu_private;
 	struct inode vfs_inode;
 };