tux3: Drop codes for older than kernel v3.12
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
diff --git a/fs/tux3/buffer_writeback.c b/fs/tux3/buffer_writeback.c
index 8f4a1a5..95a1c17 100644
--- a/fs/tux3/buffer_writeback.c
+++ b/fs/tux3/buffer_writeback.c
@@ -262,7 +262,6 @@
static void bufvec_page_end_io(struct page *page, int uptodate, int quiet)
{
end_page_writeback(page);
- tux3_accout_clear_writeback(page);
}
/* Completion of buffer for I/O */
diff --git a/fs/tux3/buffer_writebacklib.c b/fs/tux3/buffer_writebacklib.c
index 1b398d3..917e80b 100644
--- a/fs/tux3/buffer_writebacklib.c
+++ b/fs/tux3/buffer_writebacklib.c
@@ -109,10 +109,8 @@
PAGECACHE_TAG_TOWRITE);
spin_unlock_irqrestore(&mapping->tree_lock, flags);
}
- if (!old_writeback) {
+ if (!old_writeback)
account_page_writeback(page);
- tux3_accout_set_writeback(page);
- }
#if 0 /* FIXME */
mem_cgroup_end_update_page_stat(page, &locked, &memcg_flags);
#endif
diff --git a/fs/tux3/commit_flusher.h b/fs/tux3/commit_flusher.h
index 41a204e..2c0a144 100644
--- a/fs/tux3/commit_flusher.h
+++ b/fs/tux3/commit_flusher.h
@@ -5,15 +5,9 @@
#if TUX3_FLUSHER == TUX3_FLUSHER_ASYNC_HACK
/* Hack for BDI_CAP_NO_WRITEBACK */
-void tux3_accout_set_writeback(struct page *page);
-void tux3_accout_clear_writeback(struct page *page);
void tux3_set_mapping_bdi(struct inode *inode);
-void tux3_start_periodical_flusher(struct sb *sb);
#else
-static inline void tux3_accout_set_writeback(struct page *page) { }
-static inline void tux3_accout_clear_writeback(struct page *page) { }
static inline void tux3_set_mapping_bdi(struct inode *inode) { }
-static inline void tux3_start_periodical_flusher(struct sb *sb) { }
#endif
int tux3_init_flusher(struct sb *sb);
diff --git a/fs/tux3/commit_flusher_hack.c b/fs/tux3/commit_flusher_hack.c
index 3925a0e..b5d67ff 100644
--- a/fs/tux3/commit_flusher_hack.c
+++ b/fs/tux3/commit_flusher_hack.c
@@ -236,7 +236,7 @@
return work;
}
-static long tux3_do_writeback(struct bdi_writeback *wb, int force_wait)
+static long tux3_do_writeback(struct bdi_writeback *wb)
{
struct backing_dev_info *bdi = wb->bdi;
struct wb_writeback_work *work = NULL;
@@ -252,14 +252,6 @@
work->range_cyclic, work->for_background,
work->reason, work->done);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
- /*
- * Override sync mode, in case we must wait for completion
- * because this thread is exiting now.
- */
- if (force_wait)
- work->sync_mode = WB_SYNC_ALL;
-#endif
wrote += tux3_wb_writeback(wb, work);
/*
@@ -283,176 +275,6 @@
return wrote;
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
-#define TUX3_BDI_CAP (BDI_CAP_NO_WRITEBACK | BDI_CAP_MAP_COPY)
-
-/*
- * HACK: We set BDI_CAP_NO_WRITEBACK to bdi to disable flusher task
- * management to overwrite flusher task.
- *
- * But, BDI_CAP_NO_WRITEBACK disables also some functionality. So, we
- * replace some check by own check.
- *
- * FIXME: Remove this file after implement of flusher interface
- */
-
-void tux3_accout_set_writeback(struct page *page)
-{
- /*
- * Hack: BDI_CAP_NO_WRITEBACK disables this accouting, so we
- * do ourself instead.
- */
- struct address_space *mapping = page->mapping;
- if (mapping)
- inc_bdi_stat(mapping->backing_dev_info, BDI_WRITEBACK);
-}
-
-void tux3_accout_clear_writeback(struct page *page)
-{
- /*
- * Hack: BDI_CAP_NO_WRITEBACK disables this accouting, so we
- * do ourself instead.
- */
- struct address_space *mapping = page->mapping;
- if (mapping) {
- dec_bdi_stat(mapping->backing_dev_info, BDI_WRITEBACK);
- bdi_writeout_inc(mapping->backing_dev_info);
- }
-}
-
-/*
- * If dirty inode list was empty, we start the timer for periodical
- * flush. (based on bdi_wakeup_thread_delayed())
- *
- * Hack: BDI_CAP_NO_WRITEBACK disables to wakeup flusher. So, we do
- * ourself instead.
- */
-void tux3_start_periodical_flusher(struct sb *sb)
-{
- struct backing_dev_info *bdi = vfs_sb(sb)->s_bdi;
- unsigned long timeout;
-
- timeout = msecs_to_jiffies(dirty_writeback_interval * 10);
- mod_timer(&bdi->wb.wakeup_timer, jiffies + timeout);
-}
-
-/*
- * Handle writeback of dirty data for the device backed by this bdi. Also
- * wakes up periodically and does kupdated style flushing.
- */
-static int tux3_writeback_thread(void *data)
-{
- struct bdi_writeback *wb = data;
- struct backing_dev_info *bdi = wb->bdi;
- long pages_written;
-
- current->flags |= PF_SWAPWRITE;
- set_freezable();
- wb->last_active = jiffies;
-
- /*
- * Our parent may run at a different priority, just set us to normal
- */
- set_user_nice(current, 0);
-
- while (!kthread_freezable_should_stop(NULL)) {
- /*
- * Remove own delayed wake-up timer, since we are already awake
- * and we'll take care of the preriodic write-back.
- */
- del_timer(&wb->wakeup_timer);
-#if 0
- {
- struct inode *inode;
- spin_lock(&wb->list_lock);
- list_for_each_entry(inode, &wb->b_dirty, i_wb_list) {
- trace("inum %Lx", tux_inode(inode)->inum);
- }
- spin_unlock(&wb->list_lock);
- }
-#endif
- pages_written = tux3_do_writeback(wb, 0);
-
- if (pages_written)
- wb->last_active = jiffies;
-
- set_current_state(TASK_INTERRUPTIBLE);
- if (!list_empty(&bdi->work_list) || kthread_should_stop()) {
- __set_current_state(TASK_RUNNING);
- continue;
- }
-
- if (wb_has_dirty_io(wb) && dirty_writeback_interval)
- schedule_timeout(msecs_to_jiffies(dirty_writeback_interval * 10));
- else {
- /*
- * We have nothing to do, so can go sleep without any
- * timeout and save power. When a work is queued or
- * something is made dirty - we will be woken up.
- */
- schedule();
- }
- }
-
- /* Flush any work that raced with us exiting */
- if (!list_empty(&bdi->work_list))
- tux3_do_writeback(wb, 1);
-
- return 0;
-}
-
-static int tux3_setup_writeback(struct sb *sb, struct backing_dev_info *bdi)
-{
- dev_t dev = vfs_sb(sb)->s_bdev->bd_dev;
- struct task_struct *task;
-
- task = kthread_create(tux3_writeback_thread, &bdi->wb,
- "flush-%s-%u:%u",
- bdi->name, MAJOR(dev), MINOR(dev));
- if (IS_ERR(task))
- return PTR_ERR(task);
-
- /*
- * The spinlock makes sure we do not lose wake-ups when racing
- * with 'bdi_queue_work()'. And as soon as the bdi thread is
- * visible, we can start it.
- */
- spin_lock_bh(&bdi->wb_lock);
- bdi->wb.task = task;
- spin_unlock_bh(&bdi->wb_lock);
-
- return 0;
-}
-
-static void tux3_wakeup_writeback(struct backing_dev_info *bdi)
-{
- wake_up_process(bdi->wb.task);
-}
-
-static void tux3_destroy_writeback(struct backing_dev_info *bdi)
-{
- /*
- * If bdi has BDI_CAP_NO_WRITEBACK, bdi_destory() doesn't
- * cleanup bdi. So, this remove it from capabilities.
- */
- bdi->capabilities &= ~BDI_CAP_NO_WRITEBACK;
- bdi_destroy(bdi);
-}
-#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) */
-#define TUX3_BDI_CAP BDI_CAP_MAP_COPY
-
-void tux3_accout_set_writeback(struct page *page)
-{
-}
-
-void tux3_accout_clear_writeback(struct page *page)
-{
-}
-
-void tux3_start_periodical_flusher(struct sb *sb)
-{
-}
-
/* Dirty hack to get bdi_wq address from module */
static struct workqueue_struct *kernel_bdi_wq;
@@ -486,7 +308,7 @@
* rescuer as work_list needs to be drained.
*/
do {
- pages_written = tux3_do_writeback(wb, 0);
+ pages_written = tux3_do_writeback(wb);
// trace_writeback_pages_written(pages_written);
} while (!list_empty(&bdi->work_list));
}
@@ -532,16 +354,6 @@
return 0;
}
-static void tux3_wakeup_writeback(struct backing_dev_info *bdi)
-{
-}
-
-static void tux3_destroy_writeback(struct backing_dev_info *bdi)
-{
- bdi_destroy(bdi);
-}
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) */
-
static int tux3_congested_fn(void *congested_data, int bdi_bits)
{
return bdi_congested(congested_data, bdi_bits);
@@ -561,7 +373,7 @@
bdi->congested_fn = tux3_congested_fn;
bdi->congested_data = vfs_sb(sb)->s_bdi;
- err = bdi_setup_and_register(bdi, "tux3", TUX3_BDI_CAP);
+ err = bdi_setup_and_register(bdi, "tux3", BDI_CAP_MAP_COPY);
if (err)
return err;
@@ -573,8 +385,6 @@
vfs_sb(sb)->s_bdi = bdi;
- tux3_wakeup_writeback(bdi);
-
return 0;
}
@@ -582,7 +392,7 @@
{
struct backing_dev_info *bdi = vfs_sb(sb)->s_bdi;
if (bdi == &sb->bdi)
- tux3_destroy_writeback(bdi);
+ bdi_destroy(bdi);
}
static void schedule_flush_delta(struct sb *sb)
diff --git a/fs/tux3/inode_vfslib.c b/fs/tux3/inode_vfslib.c
index 7b91d33..cc09623 100644
--- a/fs/tux3/inode_vfslib.c
+++ b/fs/tux3/inode_vfslib.c
@@ -31,19 +31,11 @@
change_end_if_needed(sb);
mutex_unlock(&inode->i_mutex);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)
- if (ret > 0 || ret == -EIOCBQUEUED) {
-#else
if (ret > 0) {
-#endif
ssize_t err;
err = generic_write_sync(file, iocb->ki_pos - ret, ret);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)
- if (err < 0 && ret > 0)
-#else
if (err < 0)
-#endif
ret = err;
}
return ret;
diff --git a/fs/tux3/kcompat.h b/fs/tux3/kcompat.h
index 19a65fe..b6acb2e 100644
--- a/fs/tux3/kcompat.h
+++ b/fs/tux3/kcompat.h
@@ -9,14 +9,5 @@
#include <linux/version.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)
-static inline struct inode *file_inode(struct file *file)
-{
- return file->f_dentry->d_inode;
-}
-
-#define MODULE_ALIAS_FS(x)
-#endif
-
#endif /* !__KERNEL__ */
#endif /* !TUX3_KCOMPAT_H */
diff --git a/fs/tux3/writeback.c b/fs/tux3/writeback.c
index 80a3a91..df4f4bf 100644
--- a/fs/tux3/writeback.c
+++ b/fs/tux3/writeback.c
@@ -182,7 +182,7 @@
unsigned mask = tux3_dirty_mask(flags, delta);
struct sb_delta_dirty *s_ddc;
struct inode_delta_dirty *i_ddc;
- int re_dirtied = 0, initial_dirty = 0;
+ int re_dirtied = 0;
if ((tuxnode->flags & mask) == mask)
return;
@@ -206,7 +206,6 @@
if (s_ddc) {
spin_lock(&sb->dirty_inodes_lock);
- initial_dirty = list_empty(&s_ddc->dirty_inodes);
if (list_empty(&i_ddc->dirty_list)) {
list_add_tail(&i_ddc->dirty_list,
&s_ddc->dirty_inodes);
@@ -224,13 +223,6 @@
*/
if (re_dirtied)
tux3_inode_wb_update_dirtied_when(inode);
-
- /*
- * If dirty inode list was empty, we start the timer for
- * periodical flush.
- */
- if (initial_dirty)
- tux3_start_periodical_flusher(sb);
}
/*