|
@@ -180,8 +180,7 @@ affs_get_extblock_slow(struct inode *inode, u32 ext)
|
|
ext_key = be32_to_cpu(AFFS_TAIL(sb, bh)->extension);
|
|
ext_key = be32_to_cpu(AFFS_TAIL(sb, bh)->extension);
|
|
if (ext < AFFS_I(inode)->i_extcnt)
|
|
if (ext < AFFS_I(inode)->i_extcnt)
|
|
goto read_ext;
|
|
goto read_ext;
|
|
- if (ext > AFFS_I(inode)->i_extcnt)
|
|
|
|
- BUG();
|
|
|
|
|
|
+ BUG_ON(ext > AFFS_I(inode)->i_extcnt);
|
|
bh = affs_alloc_extblock(inode, bh, ext);
|
|
bh = affs_alloc_extblock(inode, bh, ext);
|
|
if (IS_ERR(bh))
|
|
if (IS_ERR(bh))
|
|
return bh;
|
|
return bh;
|
|
@@ -198,8 +197,7 @@ affs_get_extblock_slow(struct inode *inode, u32 ext)
|
|
struct buffer_head *prev_bh;
|
|
struct buffer_head *prev_bh;
|
|
|
|
|
|
/* allocate a new extended block */
|
|
/* allocate a new extended block */
|
|
- if (ext > AFFS_I(inode)->i_extcnt)
|
|
|
|
- BUG();
|
|
|
|
|
|
+ BUG_ON(ext > AFFS_I(inode)->i_extcnt);
|
|
|
|
|
|
/* get previous extended block */
|
|
/* get previous extended block */
|
|
prev_bh = affs_get_extblock(inode, ext - 1);
|
|
prev_bh = affs_get_extblock(inode, ext - 1);
|
|
@@ -299,8 +297,8 @@ affs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh_resul
|
|
struct buffer_head *ext_bh;
|
|
struct buffer_head *ext_bh;
|
|
u32 ext;
|
|
u32 ext;
|
|
|
|
|
|
- pr_debug("%s(%u, %lu)\n",
|
|
|
|
- __func__, (u32)inode->i_ino, (unsigned long)block);
|
|
|
|
|
|
+ pr_debug("%s(%lu, %llu)\n", __func__, inode->i_ino,
|
|
|
|
+ (unsigned long long)block);
|
|
|
|
|
|
BUG_ON(block > (sector_t)0x7fffffffUL);
|
|
BUG_ON(block > (sector_t)0x7fffffffUL);
|
|
|
|
|
|
@@ -330,8 +328,9 @@ affs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh_resul
|
|
|
|
|
|
/* store new block */
|
|
/* store new block */
|
|
if (bh_result->b_blocknr)
|
|
if (bh_result->b_blocknr)
|
|
- affs_warning(sb, "get_block", "block already set (%lx)",
|
|
|
|
- (unsigned long)bh_result->b_blocknr);
|
|
|
|
|
|
+ affs_warning(sb, "get_block",
|
|
|
|
+ "block already set (%llx)",
|
|
|
|
+ (unsigned long long)bh_result->b_blocknr);
|
|
AFFS_BLOCK(sb, ext_bh, block) = cpu_to_be32(blocknr);
|
|
AFFS_BLOCK(sb, ext_bh, block) = cpu_to_be32(blocknr);
|
|
AFFS_HEAD(ext_bh)->block_count = cpu_to_be32(block + 1);
|
|
AFFS_HEAD(ext_bh)->block_count = cpu_to_be32(block + 1);
|
|
affs_adjust_checksum(ext_bh, blocknr - bh_result->b_blocknr + 1);
|
|
affs_adjust_checksum(ext_bh, blocknr - bh_result->b_blocknr + 1);
|
|
@@ -353,8 +352,8 @@ affs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh_resul
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
err_big:
|
|
err_big:
|
|
- affs_error(inode->i_sb, "get_block", "strange block request %d",
|
|
|
|
- (int)block);
|
|
|
|
|
|
+ affs_error(inode->i_sb, "get_block", "strange block request %llu",
|
|
|
|
+ (unsigned long long)block);
|
|
return -EIO;
|
|
return -EIO;
|
|
err_ext:
|
|
err_ext:
|
|
// unlock cache
|
|
// unlock cache
|
|
@@ -399,6 +398,13 @@ affs_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter,
|
|
size_t count = iov_iter_count(iter);
|
|
size_t count = iov_iter_count(iter);
|
|
ssize_t ret;
|
|
ssize_t ret;
|
|
|
|
|
|
|
|
+ if (rw == WRITE) {
|
|
|
|
+ loff_t size = offset + count;
|
|
|
|
+
|
|
|
|
+ if (AFFS_I(inode)->mmu_private < size)
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, affs_get_block);
|
|
ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, affs_get_block);
|
|
if (ret < 0 && (rw & WRITE))
|
|
if (ret < 0 && (rw & WRITE))
|
|
affs_write_failed(mapping, offset + count);
|
|
affs_write_failed(mapping, offset + count);
|
|
@@ -503,7 +509,7 @@ affs_do_readpage_ofs(struct page *page, unsigned to)
|
|
u32 bidx, boff, bsize;
|
|
u32 bidx, boff, bsize;
|
|
u32 tmp;
|
|
u32 tmp;
|
|
|
|
|
|
- pr_debug("%s(%u, %ld, 0, %d)\n", __func__, (u32)inode->i_ino,
|
|
|
|
|
|
+ pr_debug("%s(%lu, %ld, 0, %d)\n", __func__, inode->i_ino,
|
|
page->index, to);
|
|
page->index, to);
|
|
BUG_ON(to > PAGE_CACHE_SIZE);
|
|
BUG_ON(to > PAGE_CACHE_SIZE);
|
|
kmap(page);
|
|
kmap(page);
|
|
@@ -539,7 +545,7 @@ affs_extent_file_ofs(struct inode *inode, u32 newsize)
|
|
u32 size, bsize;
|
|
u32 size, bsize;
|
|
u32 tmp;
|
|
u32 tmp;
|
|
|
|
|
|
- pr_debug("%s(%u, %d)\n", __func__, (u32)inode->i_ino, newsize);
|
|
|
|
|
|
+ pr_debug("%s(%lu, %d)\n", __func__, inode->i_ino, newsize);
|
|
bsize = AFFS_SB(sb)->s_data_blksize;
|
|
bsize = AFFS_SB(sb)->s_data_blksize;
|
|
bh = NULL;
|
|
bh = NULL;
|
|
size = AFFS_I(inode)->mmu_private;
|
|
size = AFFS_I(inode)->mmu_private;
|
|
@@ -608,7 +614,7 @@ affs_readpage_ofs(struct file *file, struct page *page)
|
|
u32 to;
|
|
u32 to;
|
|
int err;
|
|
int err;
|
|
|
|
|
|
- pr_debug("%s(%u, %ld)\n", __func__, (u32)inode->i_ino, page->index);
|
|
|
|
|
|
+ pr_debug("%s(%lu, %ld)\n", __func__, inode->i_ino, page->index);
|
|
to = PAGE_CACHE_SIZE;
|
|
to = PAGE_CACHE_SIZE;
|
|
if (((page->index + 1) << PAGE_CACHE_SHIFT) > inode->i_size) {
|
|
if (((page->index + 1) << PAGE_CACHE_SHIFT) > inode->i_size) {
|
|
to = inode->i_size & ~PAGE_CACHE_MASK;
|
|
to = inode->i_size & ~PAGE_CACHE_MASK;
|
|
@@ -631,8 +637,8 @@ static int affs_write_begin_ofs(struct file *file, struct address_space *mapping
|
|
pgoff_t index;
|
|
pgoff_t index;
|
|
int err = 0;
|
|
int err = 0;
|
|
|
|
|
|
- pr_debug("%s(%u, %llu, %llu)\n", __func__, (u32)inode->i_ino,
|
|
|
|
- (unsigned long long)pos, (unsigned long long)pos + len);
|
|
|
|
|
|
+ pr_debug("%s(%lu, %llu, %llu)\n", __func__, inode->i_ino, pos,
|
|
|
|
+ pos + len);
|
|
if (pos > AFFS_I(inode)->mmu_private) {
|
|
if (pos > AFFS_I(inode)->mmu_private) {
|
|
/* XXX: this probably leaves a too-big i_size in case of
|
|
/* XXX: this probably leaves a too-big i_size in case of
|
|
* failure. Should really be updating i_size at write_end time
|
|
* failure. Should really be updating i_size at write_end time
|
|
@@ -681,9 +687,8 @@ static int affs_write_end_ofs(struct file *file, struct address_space *mapping,
|
|
* due to write_begin.
|
|
* due to write_begin.
|
|
*/
|
|
*/
|
|
|
|
|
|
- pr_debug("%s(%u, %llu, %llu)\n",
|
|
|
|
- __func__, (u32)inode->i_ino, (unsigned long long)pos,
|
|
|
|
- (unsigned long long)pos + len);
|
|
|
|
|
|
+ pr_debug("%s(%lu, %llu, %llu)\n", __func__, inode->i_ino, pos,
|
|
|
|
+ pos + len);
|
|
bsize = AFFS_SB(sb)->s_data_blksize;
|
|
bsize = AFFS_SB(sb)->s_data_blksize;
|
|
data = page_address(page);
|
|
data = page_address(page);
|
|
|
|
|
|
@@ -831,8 +836,8 @@ affs_truncate(struct inode *inode)
|
|
struct buffer_head *ext_bh;
|
|
struct buffer_head *ext_bh;
|
|
int i;
|
|
int i;
|
|
|
|
|
|
- pr_debug("truncate(inode=%d, oldsize=%u, newsize=%u)\n",
|
|
|
|
- (u32)inode->i_ino, (u32)AFFS_I(inode)->mmu_private, (u32)inode->i_size);
|
|
|
|
|
|
+ pr_debug("truncate(inode=%lu, oldsize=%llu, newsize=%llu)\n",
|
|
|
|
+ inode->i_ino, AFFS_I(inode)->mmu_private, inode->i_size);
|
|
|
|
|
|
last_blk = 0;
|
|
last_blk = 0;
|
|
ext = 0;
|
|
ext = 0;
|
|
@@ -863,7 +868,7 @@ affs_truncate(struct inode *inode)
|
|
if (IS_ERR(ext_bh)) {
|
|
if (IS_ERR(ext_bh)) {
|
|
affs_warning(sb, "truncate",
|
|
affs_warning(sb, "truncate",
|
|
"unexpected read error for ext block %u (%ld)",
|
|
"unexpected read error for ext block %u (%ld)",
|
|
- (unsigned int)ext, PTR_ERR(ext_bh));
|
|
|
|
|
|
+ ext, PTR_ERR(ext_bh));
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
if (AFFS_I(inode)->i_lc) {
|
|
if (AFFS_I(inode)->i_lc) {
|
|
@@ -911,7 +916,7 @@ affs_truncate(struct inode *inode)
|
|
if (IS_ERR(bh)) {
|
|
if (IS_ERR(bh)) {
|
|
affs_warning(sb, "truncate",
|
|
affs_warning(sb, "truncate",
|
|
"unexpected read error for last block %u (%ld)",
|
|
"unexpected read error for last block %u (%ld)",
|
|
- (unsigned int)ext, PTR_ERR(bh));
|
|
|
|
|
|
+ ext, PTR_ERR(bh));
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
tmp = be32_to_cpu(AFFS_DATA_HEAD(bh)->next);
|
|
tmp = be32_to_cpu(AFFS_DATA_HEAD(bh)->next);
|