|
@@ -48,38 +48,46 @@ static secno hpfs_bmap(struct inode *inode, unsigned file_secno)
|
|
static void hpfs_truncate(struct inode *i)
|
|
static void hpfs_truncate(struct inode *i)
|
|
{
|
|
{
|
|
if (IS_IMMUTABLE(i)) return /*-EPERM*/;
|
|
if (IS_IMMUTABLE(i)) return /*-EPERM*/;
|
|
- hpfs_lock(i->i_sb);
|
|
|
|
|
|
+ hpfs_lock_assert(i->i_sb);
|
|
|
|
+
|
|
hpfs_i(i)->i_n_secs = 0;
|
|
hpfs_i(i)->i_n_secs = 0;
|
|
i->i_blocks = 1 + ((i->i_size + 511) >> 9);
|
|
i->i_blocks = 1 + ((i->i_size + 511) >> 9);
|
|
hpfs_i(i)->mmu_private = i->i_size;
|
|
hpfs_i(i)->mmu_private = i->i_size;
|
|
hpfs_truncate_btree(i->i_sb, i->i_ino, 1, ((i->i_size + 511) >> 9));
|
|
hpfs_truncate_btree(i->i_sb, i->i_ino, 1, ((i->i_size + 511) >> 9));
|
|
hpfs_write_inode(i);
|
|
hpfs_write_inode(i);
|
|
hpfs_i(i)->i_n_secs = 0;
|
|
hpfs_i(i)->i_n_secs = 0;
|
|
- hpfs_unlock(i->i_sb);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
static int hpfs_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create)
|
|
static int hpfs_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create)
|
|
{
|
|
{
|
|
|
|
+ int r;
|
|
secno s;
|
|
secno s;
|
|
|
|
+ hpfs_lock(inode->i_sb);
|
|
s = hpfs_bmap(inode, iblock);
|
|
s = hpfs_bmap(inode, iblock);
|
|
if (s) {
|
|
if (s) {
|
|
map_bh(bh_result, inode->i_sb, s);
|
|
map_bh(bh_result, inode->i_sb, s);
|
|
- return 0;
|
|
|
|
|
|
+ goto ret_0;
|
|
}
|
|
}
|
|
- if (!create) return 0;
|
|
|
|
|
|
+ if (!create) goto ret_0;
|
|
if (iblock<<9 != hpfs_i(inode)->mmu_private) {
|
|
if (iblock<<9 != hpfs_i(inode)->mmu_private) {
|
|
BUG();
|
|
BUG();
|
|
- return -EIO;
|
|
|
|
|
|
+ r = -EIO;
|
|
|
|
+ goto ret_r;
|
|
}
|
|
}
|
|
if ((s = hpfs_add_sector_to_btree(inode->i_sb, inode->i_ino, 1, inode->i_blocks - 1)) == -1) {
|
|
if ((s = hpfs_add_sector_to_btree(inode->i_sb, inode->i_ino, 1, inode->i_blocks - 1)) == -1) {
|
|
hpfs_truncate_btree(inode->i_sb, inode->i_ino, 1, inode->i_blocks - 1);
|
|
hpfs_truncate_btree(inode->i_sb, inode->i_ino, 1, inode->i_blocks - 1);
|
|
- return -ENOSPC;
|
|
|
|
|
|
+ r = -ENOSPC;
|
|
|
|
+ goto ret_r;
|
|
}
|
|
}
|
|
inode->i_blocks++;
|
|
inode->i_blocks++;
|
|
hpfs_i(inode)->mmu_private += 512;
|
|
hpfs_i(inode)->mmu_private += 512;
|
|
set_buffer_new(bh_result);
|
|
set_buffer_new(bh_result);
|
|
map_bh(bh_result, inode->i_sb, s);
|
|
map_bh(bh_result, inode->i_sb, s);
|
|
- return 0;
|
|
|
|
|
|
+ ret_0:
|
|
|
|
+ r = 0;
|
|
|
|
+ ret_r:
|
|
|
|
+ hpfs_unlock(inode->i_sb);
|
|
|
|
+ return r;
|
|
}
|
|
}
|
|
|
|
|
|
static int hpfs_writepage(struct page *page, struct writeback_control *wbc)
|
|
static int hpfs_writepage(struct page *page, struct writeback_control *wbc)
|
|
@@ -130,8 +138,11 @@ static ssize_t hpfs_file_write(struct file *file, const char __user *buf,
|
|
ssize_t retval;
|
|
ssize_t retval;
|
|
|
|
|
|
retval = do_sync_write(file, buf, count, ppos);
|
|
retval = do_sync_write(file, buf, count, ppos);
|
|
- if (retval > 0)
|
|
|
|
|
|
+ if (retval > 0) {
|
|
|
|
+ hpfs_lock(file->f_path.dentry->d_sb);
|
|
hpfs_i(file->f_path.dentry->d_inode)->i_dirty = 1;
|
|
hpfs_i(file->f_path.dentry->d_inode)->i_dirty = 1;
|
|
|
|
+ hpfs_unlock(file->f_path.dentry->d_sb);
|
|
|
|
+ }
|
|
return retval;
|
|
return retval;
|
|
}
|
|
}
|
|
|
|
|