From ee1efa11df5167fce81874eff747dee4d8d53f6f Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Wed, 25 Sep 2013 15:40:31 +0400 Subject: [PATCH] sb: use s_maxbytes field instead of hardcoded check in simplefs_write() generic_write_checks() will do this for us now, using s_maxbytes field from sb. --- simple.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/simple.c b/simple.c index 5696ac8..4e4d165 100644 --- a/simple.c +++ b/simple.c @@ -318,11 +318,6 @@ ssize_t simplefs_write(struct file * filp, const char __user * buf, size_t len, sfs_inode = SIMPLEFS_INODE(inode); sb = inode->i_sb; - if (*ppos + len >= SIMPLEFS_DEFAULT_BLOCK_SIZE) { - printk(KERN_ERR "File size write will exceed a block"); - return -ENOSPC; - } - bh = sb_bread(filp->f_path.dentry->d_inode->i_sb, sfs_inode->data_block_number); @@ -698,6 +693,8 @@ int simplefs_fill_super(struct super_block *sb, void *data, int silent) /* For all practical purposes, we will be using this s_fs_info as the super block */ sb->s_fs_info = sb_disk; + sb->s_maxbytes = SIMPLEFS_DEFAULT_BLOCK_SIZE; + root_inode = new_inode(sb); root_inode->i_ino = SIMPLEFS_ROOTDIR_INODE_NUMBER; inode_init_owner(root_inode, NULL, S_IFDIR);