7 #include <linux/module.h>
36 struct buffer_head *bh;
66 if (extent_count > max_extents)
74 for (; extent_count > 1; extent_count--) {
86 if (last != inode->
i_ino)
106 static void omfs_truncate(
struct inode *
inode)
109 mark_inode_dirty(inode);
138 if (extent_count < 1)
142 terminator = entry + extent_count - 1;
143 if (extent_count > 1) {
144 entry = terminator-1;
163 &new_block, &new_count);
196 for (; count > 1; count--) {
197 int numblocks = clus_to_blk(OMFS_SB(inode->
i_sb),
200 if (block >= searched &&
201 block < searched + numblocks) {
206 *left = numblocks - (block - searched);
207 return clus_to_blk(OMFS_SB(inode->
i_sb),
211 searched += numblocks;
217 static int omfs_get_block(
struct inode *inode,
sector_t block,
218 struct buffer_head *bh_result,
int create)
220 struct buffer_head *bh;
229 int max_blocks = bh_result->b_size >> inode->
i_blkbits;
250 if (extent_count > max_extents)
253 offset = find_block(inode, entry, block, extent_count, &remain);
256 map_bh(bh_result, inode->
i_sb, offset);
257 if (remain > max_blocks)
259 bh_result->b_size = (remain << inode->
i_blkbits);
273 ret = omfs_grow_extent(inode, oe, &new_block);
276 mark_inode_dirty(inode);
277 map_bh(bh_result, inode->
i_sb,
278 clus_to_blk(sbi, new_block));
310 loff_t
pos,
unsigned len,
unsigned flags,
311 struct page **pagep,
void **fsdata)
318 loff_t isize = mapping->
host->i_size;
319 if (pos + len > isize)
344 struct inode *inode = dentry->
d_inode;
352 attr->
ia_size != i_size_read(inode)) {
359 mark_inode_dirty(inode);
364 .setattr = omfs_setattr,
365 .truncate = omfs_truncate
369 .readpage = omfs_readpage,
370 .readpages = omfs_readpages,
371 .writepage = omfs_writepage,
372 .writepages = omfs_writepages,
373 .write_begin = omfs_write_begin,