#include "truncate.h"
#include <trace/events/ext4.h>
+#include <linux/blkdev.h>
#define MPAGE_DA_EXTENT_TAIL 0x01
* Note that directories do not have this problem because they
* don't use page cache.
*/
- if (ext4_should_journal_data(inode) &&
- (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode)) &&
- inode->i_ino != EXT4_JOURNAL_INO) {
+ if (inode->i_ino != EXT4_JOURNAL_INO &&
+ ext4_should_journal_data(inode) &&
+ (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode))) {
journal_t *journal = EXT4_SB(inode->i_sb)->s_journal;
tid_t commit_tid = EXT4_I(inode)->i_datasync_tid;
struct page *page;
pgoff_t index;
unsigned from, to;
+#if defined(FEATURE_STORAGE_PID_LOGGER)
+ extern unsigned char *page_logger;
+ struct page_pid_logger *tmp_logger;
+ unsigned long page_index;
+ extern spinlock_t g_locker;
+ unsigned long g_flags;
+#endif
trace_ext4_write_begin(inode, pos, len, flags);
/*
return ret;
}
*pagep = page;
+#if defined(FEATURE_STORAGE_PID_LOGGER)
+ if( page_logger && (*pagep)) {
+ //#if defined(CONFIG_FLATMEM)
+ //page_index = (unsigned long)((*pagep) - mem_map) ;
+ //#else
+ page_index = (unsigned long)(__page_to_pfn(*pagep))- PHYS_PFN_OFFSET;
+ //#endif
+ tmp_logger =((struct page_pid_logger *)page_logger) + page_index;
+ spin_lock_irqsave(&g_locker, g_flags);
+ if( page_index < num_physpages) {
+ if( tmp_logger->pid1 == 0XFFFF)
+ tmp_logger->pid1 = current->pid;
+ else if( tmp_logger->pid1 != current->pid)
+ tmp_logger->pid2 = current->pid;
+ }
+ spin_unlock_irqrestore(&g_locker, g_flags);
+ }
+#endif
return ret;
}
static void ext4_da_page_release_reservation(struct page *page,
unsigned long offset)
{
- int to_release = 0;
+ int to_release = 0, contiguous_blks = 0;
struct buffer_head *head, *bh;
unsigned int curr_off = 0;
struct inode *inode = page->mapping->host;
if ((offset <= curr_off) && (buffer_delay(bh))) {
to_release++;
+ contiguous_blks++;
clear_buffer_delay(bh);
+ } else if (contiguous_blks) {
+ lblk = page->index <<
+ (PAGE_CACHE_SHIFT - inode->i_blkbits);
+ lblk += (curr_off >> inode->i_blkbits) -
+ contiguous_blks;
+ ext4_es_remove_extent(inode, lblk, contiguous_blks);
+ contiguous_blks = 0;
}
curr_off = next_off;
} while ((bh = bh->b_this_page) != head);
- if (to_release) {
+ if (contiguous_blks) {
lblk = page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits);
- ext4_es_remove_extent(inode, lblk, to_release);
+ lblk += (curr_off >> inode->i_blkbits) - contiguous_blks;
+ ext4_es_remove_extent(inode, lblk, contiguous_blks);
}
/* If we have released all the blocks belonging to a cluster, then we
int ext4_punch_hole(struct file *file, loff_t offset, loff_t length)
{
+#if 0
struct inode *inode = file_inode(file);
struct super_block *sb = inode->i_sb;
ext4_lblk_t first_block, stop_block;
out_mutex:
mutex_unlock(&inode->i_mutex);
return ret;
+#else
+ /*
+ * Disabled as per b/28760453
+ */
+ return -EOPNOTSUPP;
+#endif
}
/*
trace_ext4_load_inode(inode);
get_bh(bh);
bh->b_end_io = end_buffer_read_sync;
+#ifdef FEATURE_STORAGE_META_LOG
+ if( bh && bh->b_bdev && bh->b_bdev->bd_disk)
+ set_metadata_rw_status(bh->b_bdev->bd_disk->first_minor, WAIT_READ_CNT);
+#endif
submit_bh(READ | REQ_META | REQ_PRIO, bh);
wait_on_buffer(bh);
if (!buffer_uptodate(bh)) {
might_sleep();
trace_ext4_mark_inode_dirty(inode, _RET_IP_);
err = ext4_reserve_inode_write(handle, inode, &iloc);
+ if (err)
+ return err;
if (ext4_handle_valid(handle) &&
EXT4_I(inode)->i_extra_isize < sbi->s_want_extra_isize &&
!ext4_test_inode_state(inode, EXT4_STATE_NO_EXPAND)) {
}
}
}
- if (!err)
- err = ext4_mark_iloc_dirty(handle, inode, &iloc);
- return err;
+ return ext4_mark_iloc_dirty(handle, inode, &iloc);
}
/*