summaryrefslogtreecommitdiffstats
path: root/fs/fat/file.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-01-29 01:41:54 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-01-29 01:41:54 +0000
commitf969d69ba9f952e5bdd38278e25e26a3e4a61a70 (patch)
treeb3530d803df59d726afaabebc6626987dee1ca05 /fs/fat/file.c
parenta10ce7ef2066b455d69187643ddf2073bfc4db24 (diff)
Merge with 2.3.27.
Diffstat (limited to 'fs/fat/file.c')
-rw-r--r--fs/fat/file.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/fat/file.c b/fs/fat/file.c
index 505dc4e06..9c2c159cb 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -118,8 +118,8 @@ static int fat_write_partial_page(struct file *file, struct page *page, unsigned
struct page *page_cache = NULL;
long status;
- pgpos = MSDOS_I(inode)->i_realsize & PAGE_CACHE_MASK;
- while (pgpos < page->offset) {
+ pgpos = MSDOS_I(inode)->i_realsize >> PAGE_CACHE_SHIFT;
+ while (pgpos < page->index) {
hash = page_hash(&inode->i_data, pgpos);
repeat_find: new_page = __find_lock_page(&inode->i_data, pgpos, hash);
if (!new_page) {
@@ -140,7 +140,7 @@ repeat_find: new_page = __find_lock_page(&inode->i_data, pgpos, hash);
page_cache_release(new_page);
if (status < 0)
goto out;
- pgpos = MSDOS_I(inode)->i_realsize & PAGE_CACHE_MASK;
+ pgpos = MSDOS_I(inode)->i_realsize >> PAGE_CACHE_SHIFT;
}
status = block_write_cont_page(file, page, offset, bytes, buf);
out:
@@ -182,6 +182,7 @@ ssize_t default_fat_file_write(
void fat_truncate(struct inode *inode)
{
+ struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
int cluster;
/* Why no return value? Surely the disk could fail... */
@@ -189,9 +190,9 @@ void fat_truncate(struct inode *inode)
return /* -EPERM */;
if (IS_IMMUTABLE(inode))
return /* -EPERM */;
- cluster = SECTOR_SIZE*MSDOS_SB(inode->i_sb)->cluster_size;
+ cluster = SECTOR_SIZE*sbi->cluster_size;
MSDOS_I(inode)->i_realsize = ((inode->i_size-1) | (SECTOR_SIZE-1)) + 1;
- (void) fat_free(inode,(inode->i_size+(cluster-1))/cluster);
+ fat_free(inode,(inode->i_size+(cluster-1))>>sbi->cluster_bits);
MSDOS_I(inode)->i_attrs |= ATTR_ARCH;
inode->i_ctime = inode->i_mtime = CURRENT_TIME;
mark_inode_dirty(inode);