file.c (907bc6c7fc7071b00083fc11e510e47dd93df45d) file.c (155130a4f7848b1aac439cab6bda1a175507c71c)
1/*
2 * fs/bfs/file.c
3 * BFS file operations.
4 * Copyright (C) 1999,2000 Tigran Aivazian <tigran@veritas.com>
5 *
6 * Make the file block allocation algorithm understand the size
7 * of the underlying block device.
8 * Copyright (C) 2007 Dmitri Vorobiev <dmitri.vorobiev@gmail.com>

--- 154 unchanged lines hidden (view full) ---

163{
164 return block_read_full_page(page, bfs_get_block);
165}
166
167static int bfs_write_begin(struct file *file, struct address_space *mapping,
168 loff_t pos, unsigned len, unsigned flags,
169 struct page **pagep, void **fsdata)
170{
1/*
2 * fs/bfs/file.c
3 * BFS file operations.
4 * Copyright (C) 1999,2000 Tigran Aivazian <tigran@veritas.com>
5 *
6 * Make the file block allocation algorithm understand the size
7 * of the underlying block device.
8 * Copyright (C) 2007 Dmitri Vorobiev <dmitri.vorobiev@gmail.com>

--- 154 unchanged lines hidden (view full) ---

163{
164 return block_read_full_page(page, bfs_get_block);
165}
166
167static int bfs_write_begin(struct file *file, struct address_space *mapping,
168 loff_t pos, unsigned len, unsigned flags,
169 struct page **pagep, void **fsdata)
170{
171 *pagep = NULL;
172 return block_write_begin(file, mapping, pos, len, flags,
173 pagep, fsdata, bfs_get_block);
171 int ret;
172
173 ret = block_write_begin(mapping, pos, len, flags, pagep,
174 bfs_get_block);
175 if (unlikely(ret)) {
176 loff_t isize = mapping->host->i_size;
177 if (pos + len > isize)
178 vmtruncate(mapping->host, isize);
179 }
180
181 return ret;
174}
175
176static sector_t bfs_bmap(struct address_space *mapping, sector_t block)
177{
178 return generic_block_bmap(mapping, block, bfs_get_block);
179}
180
181const struct address_space_operations bfs_aops = {
182 .readpage = bfs_readpage,
183 .writepage = bfs_writepage,
184 .sync_page = block_sync_page,
185 .write_begin = bfs_write_begin,
186 .write_end = generic_write_end,
187 .bmap = bfs_bmap,
188};
189
190const struct inode_operations bfs_file_inops;
182}
183
184static sector_t bfs_bmap(struct address_space *mapping, sector_t block)
185{
186 return generic_block_bmap(mapping, block, bfs_get_block);
187}
188
189const struct address_space_operations bfs_aops = {
190 .readpage = bfs_readpage,
191 .writepage = bfs_writepage,
192 .sync_page = block_sync_page,
193 .write_begin = bfs_write_begin,
194 .write_end = generic_write_end,
195 .bmap = bfs_bmap,
196};
197
198const struct inode_operations bfs_file_inops;