11 #define BLOCKS(size) (((size) + 511) >> 9)
15 hpfs_lock(inode->
i_sb);
17 hpfs_unlock(inode->
i_sb);
40 unsigned n, disk_secno;
42 struct buffer_head *bh;
43 if (
BLOCKS(hpfs_i(inode)->mmu_private) <= file_secno)
return 0;
45 if (n < hpfs_inode->i_n_secs)
return hpfs_inode->
i_disk_sec +
n;
48 if (disk_secno == -1)
return 0;
53 static void hpfs_truncate(
struct inode *
i)
56 hpfs_lock_assert(i->
i_sb);
58 hpfs_i(i)->i_n_secs = 0;
60 hpfs_i(i)->mmu_private = i->
i_size;
63 hpfs_i(i)->i_n_secs = 0;
66 static int hpfs_get_block(
struct inode *inode,
sector_t iblock,
struct buffer_head *bh_result,
int create)
70 hpfs_lock(inode->
i_sb);
71 s = hpfs_bmap(inode, iblock);
73 map_bh(bh_result, inode->
i_sb, s);
76 if (!create)
goto ret_0;
77 if (iblock<<9 != hpfs_i(inode)->mmu_private) {
88 hpfs_i(inode)->mmu_private += 512;
89 set_buffer_new(bh_result);
90 map_bh(bh_result, inode->
i_sb, s);
94 hpfs_unlock(inode->
i_sb);
109 loff_t
pos,
unsigned len,
unsigned flags,
110 struct page **pagep,
void **fsdata)
117 &hpfs_i(mapping->
host)->mmu_private);
119 loff_t isize = mapping->
host->i_size;
120 if (pos + len > isize)
133 .readpage = hpfs_readpage,
134 .writepage = hpfs_writepage,
135 .write_begin = hpfs_write_begin,
140 static ssize_t hpfs_file_write(
struct file *file,
const char __user *
buf,
141 size_t count, loff_t *ppos)
147 hpfs_lock(file->
f_path.dentry->d_sb);
148 hpfs_i(file->
f_path.dentry->d_inode)->i_dirty = 1;
149 hpfs_unlock(file->
f_path.dentry->d_sb);
159 .write = hpfs_file_write,
162 .release = hpfs_file_release,
169 .truncate = hpfs_truncate,