5 #include <linux/time.h>
9 #include <asm/uaccess.h>
32 static int reiserfs_file_release(
struct inode *
inode,
struct file *filp)
37 int jbegin_failure = 0;
41 if (atomic_add_unless(&REISERFS_I(inode)->openers, -1, 1))
54 REISERFS_I(inode)->i_prealloc_count <= 0) {
84 "pinning inode %lu because the "
85 "preallocation can't be freed",
92 #ifdef REISERFS_PREALLOCATE
102 (REISERFS_I(inode)->i_flags & i_pack_on_close_mask) &&
117 static int reiserfs_file_open(
struct inode *inode,
struct file *
file)
129 static void reiserfs_vfs_truncate_file(
struct inode *inode)
143 static int reiserfs_sync_file(
struct file *filp, loff_t
start, loff_t
end,
146 struct inode *inode = filp->
f_mapping->host;
163 if (barrier_done < 0)
165 return (err < 0) ? -
EIO : 0;
170 unsigned from,
unsigned to)
172 unsigned block_start, block_end;
175 struct buffer_head *bh, *
head;
178 int logit = reiserfs_file_data_log(inode);
191 goto drop_write_lock;
194 for (bh = head = page_buffers(page), block_start = 0;
195 bh != head || !block_start;
196 block_start = block_end, bh = bh->b_this_page) {
198 new = buffer_new(bh);
199 clear_buffer_new(bh);
200 block_end = block_start + blocksize;
201 if (block_end <= from || block_start >= to) {
202 if (!buffer_uptodate(bh))
205 set_buffer_uptodate(bh);
209 }
else if (!buffer_dirty(bh)) {
215 (
new || page->
index >= i_size_index)) {
233 SetPageUptodate(page);
263 static ssize_t reiserfs_file_write(
struct file *file,
264 const char __user *
buf,
271 struct inode *inode = file->
f_path.dentry->d_inode;
298 .write = reiserfs_file_write,
304 .open = reiserfs_file_open,
305 .release = reiserfs_file_release,
306 .fsync = reiserfs_sync_file,
315 .truncate = reiserfs_vfs_truncate_file,