提交 fa4c95bf 编写于 作者: L Linus Torvalds

Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs

Pull ext3, udf, quota fixes from Jan Kara:
 "Some ext3 & quota cleanups and couple of udf fixes"

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  quota: Use the pre-processor to compile out quotactl_cmd_write when !CONFIG_BLOCK
  ext3: drop if around WARN_ON
  ext3: get rid of the duplicate code on ext3_fill_super
  udf: remove un-needed variable from inode_getblk
  udf: don't increment lenExtents while writing to a hole
  udf: fix memory leak while allocating blocks during write
...@@ -1071,8 +1071,7 @@ struct buffer_head *ext3_getblk(handle_t *handle, struct inode *inode, ...@@ -1071,8 +1071,7 @@ struct buffer_head *ext3_getblk(handle_t *handle, struct inode *inode,
* mapped. 0 in case of a HOLE. * mapped. 0 in case of a HOLE.
*/ */
if (err > 0) { if (err > 0) {
if (err > 1) WARN_ON(err > 1);
WARN_ON(1);
err = 0; err = 0;
} }
*errp = err; *errp = err;
......
...@@ -1661,9 +1661,6 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) ...@@ -1661,9 +1661,6 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
return -ENOMEM; return -ENOMEM;
} }
sb->s_fs_info = sbi; sb->s_fs_info = sbi;
sbi->s_mount_opt = 0;
sbi->s_resuid = make_kuid(&init_user_ns, EXT3_DEF_RESUID);
sbi->s_resgid = make_kgid(&init_user_ns, EXT3_DEF_RESGID);
sbi->s_sb_block = sb_block; sbi->s_sb_block = sb_block;
blocksize = sb_min_blocksize(sb, EXT3_MIN_BLOCK_SIZE); blocksize = sb_min_blocksize(sb, EXT3_MIN_BLOCK_SIZE);
......
...@@ -307,6 +307,8 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id, ...@@ -307,6 +307,8 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id,
} }
} }
#ifdef CONFIG_BLOCK
/* Return 1 if 'cmd' will block on frozen filesystem */ /* Return 1 if 'cmd' will block on frozen filesystem */
static int quotactl_cmd_write(int cmd) static int quotactl_cmd_write(int cmd)
{ {
...@@ -322,6 +324,8 @@ static int quotactl_cmd_write(int cmd) ...@@ -322,6 +324,8 @@ static int quotactl_cmd_write(int cmd)
return 1; return 1;
} }
#endif /* CONFIG_BLOCK */
/* /*
* look up a superblock on which quota ops will be performed * look up a superblock on which quota ops will be performed
* - use the name of a block device to find the superblock thereon * - use the name of a block device to find the superblock thereon
......
...@@ -587,7 +587,6 @@ static int udf_extend_file(struct inode *inode, loff_t newsize) ...@@ -587,7 +587,6 @@ static int udf_extend_file(struct inode *inode, loff_t newsize)
static sector_t inode_getblk(struct inode *inode, sector_t block, static sector_t inode_getblk(struct inode *inode, sector_t block,
int *err, int *new) int *err, int *new)
{ {
static sector_t last_block;
struct kernel_long_ad laarr[EXTENT_MERGE_SIZE]; struct kernel_long_ad laarr[EXTENT_MERGE_SIZE];
struct extent_position prev_epos, cur_epos, next_epos; struct extent_position prev_epos, cur_epos, next_epos;
int count = 0, startnum = 0, endnum = 0; int count = 0, startnum = 0, endnum = 0;
...@@ -601,6 +600,7 @@ static sector_t inode_getblk(struct inode *inode, sector_t block, ...@@ -601,6 +600,7 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
struct udf_inode_info *iinfo = UDF_I(inode); struct udf_inode_info *iinfo = UDF_I(inode);
int goal = 0, pgoal = iinfo->i_location.logicalBlockNum; int goal = 0, pgoal = iinfo->i_location.logicalBlockNum;
int lastblock = 0; int lastblock = 0;
bool isBeyondEOF;
*err = 0; *err = 0;
*new = 0; *new = 0;
...@@ -676,11 +676,10 @@ static sector_t inode_getblk(struct inode *inode, sector_t block, ...@@ -676,11 +676,10 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
return newblock; return newblock;
} }
last_block = block;
/* Are we beyond EOF? */ /* Are we beyond EOF? */
if (etype == -1) { if (etype == -1) {
int ret; int ret;
isBeyondEOF = 1;
if (count) { if (count) {
if (c) if (c)
laarr[0] = laarr[1]; laarr[0] = laarr[1];
...@@ -718,11 +717,11 @@ static sector_t inode_getblk(struct inode *inode, sector_t block, ...@@ -718,11 +717,11 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
memset(&laarr[c].extLocation, 0x00, memset(&laarr[c].extLocation, 0x00,
sizeof(struct kernel_lb_addr)); sizeof(struct kernel_lb_addr));
count++; count++;
endnum++;
} }
endnum = c + 1; endnum = c + 1;
lastblock = 1; lastblock = 1;
} else { } else {
isBeyondEOF = 0;
endnum = startnum = ((count > 2) ? 2 : count); endnum = startnum = ((count > 2) ? 2 : count);
/* if the current extent is in position 0, /* if the current extent is in position 0,
...@@ -765,10 +764,13 @@ static sector_t inode_getblk(struct inode *inode, sector_t block, ...@@ -765,10 +764,13 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
goal, err); goal, err);
if (!newblocknum) { if (!newblocknum) {
brelse(prev_epos.bh); brelse(prev_epos.bh);
brelse(cur_epos.bh);
brelse(next_epos.bh);
*err = -ENOSPC; *err = -ENOSPC;
return 0; return 0;
} }
iinfo->i_lenExtents += inode->i_sb->s_blocksize; if (isBeyondEOF)
iinfo->i_lenExtents += inode->i_sb->s_blocksize;
} }
/* if the extent the requsted block is located in contains multiple /* if the extent the requsted block is located in contains multiple
...@@ -795,6 +797,8 @@ static sector_t inode_getblk(struct inode *inode, sector_t block, ...@@ -795,6 +797,8 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
udf_update_extents(inode, laarr, startnum, endnum, &prev_epos); udf_update_extents(inode, laarr, startnum, endnum, &prev_epos);
brelse(prev_epos.bh); brelse(prev_epos.bh);
brelse(cur_epos.bh);
brelse(next_epos.bh);
newblock = udf_get_pblock(inode->i_sb, newblocknum, newblock = udf_get_pblock(inode->i_sb, newblocknum,
iinfo->i_location.partitionReferenceNum, 0); iinfo->i_location.partitionReferenceNum, 0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册