+ fat-add-i_disksize-to-represent-uninitialized-size.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Subject: + fat-add-i_disksize-to-represent-uninitialized-size.patch added to -mm tree
To: namjae.jeon@xxxxxxxxxxx,a.sahrawat@xxxxxxxxxxx,hirofumi@xxxxxxxxxxxxxxxxxx
From: akpm@xxxxxxxxxxxxxxxxxxxx
Date: Thu, 10 Oct 2013 15:02:32 -0700


The patch titled
     Subject: fat: add i_disksize to represent uninitialized size
has been added to the -mm tree.  Its filename is
     fat-add-i_disksize-to-represent-uninitialized-size.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/fat-add-i_disksize-to-represent-uninitialized-size.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/fat-add-i_disksize-to-represent-uninitialized-size.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Namjae Jeon <namjae.jeon@xxxxxxxxxxx>
Subject: fat: add i_disksize to represent uninitialized size

Add i_disksize to represent uninitialized allocated size.  And mmu_private
represent initialized allocated size.

Signed-off-by: Namjae Jeon <namjae.jeon@xxxxxxxxxxx>
Signed-off-by: Amit Sahrawat <a.sahrawat@xxxxxxxxxxx>
Cc: OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 fs/fat/cache.c |    4 ++--
 fs/fat/fat.h   |    3 ++-
 fs/fat/file.c  |    4 +++-
 fs/fat/inode.c |    4 ++++
 4 files changed, 11 insertions(+), 4 deletions(-)

diff -puN fs/fat/cache.c~fat-add-i_disksize-to-represent-uninitialized-size fs/fat/cache.c
--- a/fs/fat/cache.c~fat-add-i_disksize-to-represent-uninitialized-size
+++ a/fs/fat/cache.c
@@ -329,10 +329,10 @@ int fat_bmap(struct inode *inode, sector
 			return 0;
 
 		/*
-		 * ->mmu_private can access on only allocation path.
+		 * ->i_disksize can access on only allocation path.
 		 * (caller must hold ->i_mutex)
 		 */
-		last_block = (MSDOS_I(inode)->mmu_private + (blocksize - 1))
+		last_block = (MSDOS_I(inode)->i_disksize + (blocksize - 1))
 			>> blocksize_bits;
 		if (sector >= last_block)
 			return 0;
diff -puN fs/fat/fat.h~fat-add-i_disksize-to-represent-uninitialized-size fs/fat/fat.h
--- a/fs/fat/fat.h~fat-add-i_disksize-to-represent-uninitialized-size
+++ a/fs/fat/fat.h
@@ -117,7 +117,8 @@ struct msdos_inode_info {
 	unsigned int cache_valid_id;
 
 	/* NOTE: mmu_private is 64bits, so must hold ->i_mutex to access */
-	loff_t mmu_private;	/* physically allocated size */
+	loff_t mmu_private;	/* physically allocated size (uninitialized) */
+	loff_t i_disksize;	/* physically allocated size (initialized) */
 
 	int i_start;		/* first cluster or 0 */
 	int i_logstart;		/* logical first cluster */
diff -puN fs/fat/file.c~fat-add-i_disksize-to-represent-uninitialized-size fs/fat/file.c
--- a/fs/fat/file.c~fat-add-i_disksize-to-represent-uninitialized-size
+++ a/fs/fat/file.c
@@ -300,8 +300,10 @@ void fat_truncate_blocks(struct inode *i
 	 * This protects against truncating a file bigger than it was then
 	 * trying to write into the hole.
 	 */
-	if (MSDOS_I(inode)->mmu_private > offset)
+	if (MSDOS_I(inode)->mmu_private > offset) {
 		MSDOS_I(inode)->mmu_private = offset;
+		MSDOS_I(inode)->i_disksize = offset;
+	}
 
 	nr_clusters = (offset + (cluster_size - 1)) >> sbi->cluster_bits;
 
diff -puN fs/fat/inode.c~fat-add-i_disksize-to-represent-uninitialized-size fs/fat/inode.c
--- a/fs/fat/inode.c~fat-add-i_disksize-to-represent-uninitialized-size
+++ a/fs/fat/inode.c
@@ -93,6 +93,7 @@ static inline int __fat_get_block(struct
 
 	*max_blocks = min(mapped_blocks, *max_blocks);
 	MSDOS_I(inode)->mmu_private += *max_blocks << sb->s_blocksize_bits;
+	MSDOS_I(inode)->i_disksize = MSDOS_I(inode)->mmu_private;
 
 	err = fat_bmap(inode, iblock, &phys, &mapped_blocks, create);
 	if (err)
@@ -408,6 +409,7 @@ int fat_fill_inode(struct inode *inode,
 		if (error < 0)
 			return error;
 		MSDOS_I(inode)->mmu_private = inode->i_size;
+		MSDOS_I(inode)->i_disksize = inode->i_size;
 
 		set_nlink(inode, fat_subdirs(inode));
 	} else { /* not a directory */
@@ -423,6 +425,7 @@ int fat_fill_inode(struct inode *inode,
 		inode->i_fop = &fat_file_operations;
 		inode->i_mapping->a_ops = &fat_aops;
 		MSDOS_I(inode)->mmu_private = inode->i_size;
+		MSDOS_I(inode)->i_disksize = inode->i_size;
 	}
 	if (de->attr & ATTR_SYS) {
 		if (sbi->options.sys_immutable)
@@ -1220,6 +1223,7 @@ static int fat_read_root(struct inode *i
 			   & ~((loff_t)sbi->cluster_size - 1)) >> 9;
 	MSDOS_I(inode)->i_logstart = 0;
 	MSDOS_I(inode)->mmu_private = inode->i_size;
+	MSDOS_I(inode)->i_disksize = inode->i_size;
 
 	fat_save_attrs(inode, ATTR_DIR);
 	inode->i_mtime.tv_sec = inode->i_atime.tv_sec = inode->i_ctime.tv_sec = 0;
_

Patches currently in -mm which might be from namjae.jeon@xxxxxxxxxxx are

fat-add-i_disksize-to-represent-uninitialized-size.patch
fat-add-fat_fallocate-operation.patch
fat-zero-out-seek-range-on-_fat_get_block.patch
fat-fallback-to-buffered-write-in-case-of-fallocatded-region-on-direct-io.patch
fat-permit-to-return-phy-block-number-by-fibmap-in-fallocated-region.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux