* Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README
*/
+#include <linux/config.h>
#include <linux/time.h>
#include <linux/fs.h>
#include <linux/reiserfs_fs.h>
#include <linux/vs_dlimit.h>
#include <linux/vserver/xid.h>
+extern int reiserfs_default_io_size; /* default io size devuned in super.c */
+
static int reiserfs_commit_write(struct file *f, struct page *page,
unsigned from, unsigned to);
static int reiserfs_prepare_write(struct file *f, struct page *page,
/* The = 0 happens when we abort creating a new inode for some reason like lack of space.. */
if (!(inode->i_state & I_NEW) && INODE_PKEY(inode)->k_objectid != 0) { /* also handles bad_inode case */
+ mutex_lock(&inode->i_mutex);
+
reiserfs_delete_xattrs(inode);
- if (journal_begin(&th, inode->i_sb, jbegin_count))
+ if (journal_begin(&th, inode->i_sb, jbegin_count)) {
+ mutex_unlock(&inode->i_mutex);
goto out;
+ }
reiserfs_update_inode_transaction(inode);
err = reiserfs_delete_object(&th, inode);
DQUOT_FREE_INODE(inode);
DLIMIT_FREE_INODE(inode);
- if (journal_end(&th, inode->i_sb, jbegin_count))
+ if (journal_end(&th, inode->i_sb, jbegin_count)) {
+ mutex_unlock(&inode->i_mutex);
goto out;
+ }
+
+ mutex_unlock(&inode->i_mutex);
/* check return value from reiserfs_delete_object after
* ending the transaction
direct_IO request. */
static int reiserfs_get_blocks_direct_io(struct inode *inode,
sector_t iblock,
+ unsigned long max_blocks,
struct buffer_head *bh_result,
int create)
{
ih = PATH_PITEM_HEAD(path);
copy_key(INODE_PKEY(inode), &(ih->ih_key));
+ inode->i_blksize = reiserfs_default_io_size;
INIT_LIST_HEAD(&(REISERFS_I(inode)->i_prealloc_list));
REISERFS_I(inode)->i_flags = 0;
}
// these do not go to on-disk stat data
inode->i_ino = le32_to_cpu(ih.ih_key.k_objectid);
+ inode->i_blksize = reiserfs_default_io_size;
// store in in-core inode the key of stat data and version all
// object items will have (directory items will have old offset
unsigned long end_index = inode->i_size >> PAGE_CACHE_SHIFT;
int error = 0;
unsigned long block;
- sector_t last_block;
struct buffer_head *head, *bh;
int partial = 0;
int nr = 0;
- int checked = PageFsMisc(page);
+ int checked = PageChecked(page);
struct reiserfs_transaction_handle th;
struct super_block *s = inode->i_sb;
int bh_per_page = PAGE_CACHE_SIZE / s->s_blocksize;
}
bh = head;
block = page->index << (PAGE_CACHE_SHIFT - s->s_blocksize_bits);
- last_block = (i_size_read(inode) - 1) >> inode->i_blkbits;
/* first map all the buffers, logging any direct items we find */
do {
- if (block > last_block) {
- /*
- * This can happen when the block size is less than
- * the page size. The corresponding bytes in the page
- * were zero filled above
- */
- clear_buffer_dirty(bh);
- set_buffer_uptodate(bh);
- } else if ((checked || buffer_dirty(bh)) &&
- (!buffer_mapped(bh) || (buffer_mapped(bh)
+ if ((checked || buffer_dirty(bh)) && (!buffer_mapped(bh) ||
+ (buffer_mapped(bh)
&& bh->b_blocknr ==
0))) {
/* not mapped yet, or it points to a direct item, search
* blocks we're going to log
*/
if (checked) {
- ClearPageFsMisc(page);
+ ClearPageChecked(page);
reiserfs_write_lock(s);
error = journal_begin(&th, s, bh_per_page + 1);
if (error) {
}
/* clm -- taken from fs/buffer.c:block_invalidate_page */
-static void reiserfs_invalidatepage(struct page *page, unsigned long offset)
+static int reiserfs_invalidatepage(struct page *page, unsigned long offset)
{
struct buffer_head *head, *bh, *next;
struct inode *inode = page->mapping->host;
BUG_ON(!PageLocked(page));
if (offset == 0)
- ClearPageFsMisc(page);
+ ClearPageChecked(page);
if (!page_has_buffers(page))
goto out;
* The get_block cached value has been unconditionally invalidated,
* so real IO is not possible anymore.
*/
- if (!offset && ret) {
+ if (!offset && ret)
ret = try_to_release_page(page, 0);
- /* maybe should BUG_ON(!ret); - neilb */
- }
out:
- return;
+ return ret;
}
static int reiserfs_set_page_dirty(struct page *page)
{
struct inode *inode = page->mapping->host;
if (reiserfs_file_data_log(inode)) {
- SetPageFsMisc(page);
+ SetPageChecked(page);
return __set_page_dirty_nobuffers(page);
}
return __set_page_dirty_buffers(page);
struct buffer_head *bh;
int ret = 1;
- WARN_ON(PageFsMisc(page));
+ WARN_ON(PageChecked(page));
spin_lock(&j->j_dirty_buffers_lock);
head = page_buffers(page);
bh = head;
}
if (error)
goto out;
- /*
- * file size is changed, ctime and mtime are
- * to be updated
- */
- attr->ia_valid |= (ATTR_MTIME | ATTR_CTIME);
}
}
return error;
}
-const struct address_space_operations reiserfs_address_space_operations = {
+struct address_space_operations reiserfs_address_space_operations = {
.writepage = reiserfs_writepage,
.readpage = reiserfs_readpage,
.readpages = reiserfs_readpages,