From patchwork Mon Mar 2 05:11:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: ngc-IIJ X-Patchwork-Id: 444910 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3BA5D1400B6 for ; Mon, 2 Mar 2015 16:11:45 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=ff.iij4u.or.jp header.i=ngc@ff.iij4u.or.jp header.b=nZHADMV2; dkim-adsp=unknown (unprotected policy); dkim-atps=neutral Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id A898628A912; Mon, 2 Mar 2015 06:11:23 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,T_DKIM_INVALID, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 0BCF928013B for ; Mon, 2 Mar 2015 06:11:17 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 CL_IP_EQ_HELO_IP=-2 (check from: .iij4u. - helo: .mo-sw.iij4u. - helo-domain: .iij4u.) FROM/MX_MATCHES_HELO(DOMAIN)=-2; rate: -8.5 Received: from mo-sw.iij4u.or.jp (mo-sw1500.iij4u.or.jp [210.130.239.240]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Mon, 2 Mar 2015 06:11:12 +0100 (CET) DKIM-Signature: v=1;a=rsa-sha256;c=relaxed/simple;d=ff.iij4u.or.jp;h= Message-ID:Date:From:MIME-Version:To:Subject:Content-Type: Content-Transfer-Encoding; i=ngc@ff.iij4u.or.jp; s=20140530.iij4u; t=1425273082; x=1426482682; bh=sYFBiDnkQk4Bs51hWfWVWPBaG5BjYo1QRYnH/C9pfA8=; b=nZHADMV23lkOHV Q2OFsZIoczpZRAnfk/39CNANCSuD1cGcSn6vY2DUeeeg93zRJ/vox3wyrixXH9Nq+ZjfDUC680pGZ RBvBGYtmXdtKOfp4VShWUcCXFeBGlVug7zxjY8ERuYYzyYVrbKE0WtvpL06N0NWHRL59mDlXgfCSS cUjtznxXeIdMHzkDrEfZyUNxwb1ov2Q/hrKnS6Cvdyg2IDXMlys2W1H5qQHqsyeVAm9/lO+QSTIM/ /g8Yab1mcVw+4rhn60iRD0ncKMoUxcrqkb+i+5rdpdk4S//3ummLncYd+CRw6Hy6P9D07yB21PdN5 t8OjuVqhXerIZe55B+wA==; Received: by mo-sw.iij4u.or.jp (4u-mo-sw1500) id t225BM7C020596; Mon, 2 Mar 2015 14:11:22 +0900 Received: from [172.30.170.1] (p19019-ipngnfx01sasajima.aichi.ocn.ne.jp [153.142.60.19]) by mbox.iij4u.or.jp (4u-mbox1500) id t225BLvk025277 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Mon, 2 Mar 2015 14:11:21 +0900 Message-ID: <54F3F0F9.3010404@ff.iij4u.or.jp> Date: Mon, 02 Mar 2015 14:11:21 +0900 From: ngc User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: openwrt-devel@lists.openwrt.org Subject: [OpenWrt-Devel] [PATCH 1/1] kernel: refined one of 514-yaffs-3.6-use-delayed-work-instead-of-write_super.patch X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" Modified 514-yaffs-3.6-use-delayed-work-instead-of-write_super.patch which was included old trunk, to fit the current trunk kernel. This needs to support the behavior when yaffs_auto_checkpoint is set '2', in 3.6.x and later. I got worked with linux-3.14.x on ARM. signed-off-by: ngc@ff.iij4u.or.jp ―― --- a/target/linux/generic/patches-3.14/514-yaffs-3.6-use-delayed-work-instead-of-write_super.patch 1970-01-01 09:00:00.000000000 +0900 +++ b/target/linux/generic/patches-3.14/514-yaffs-3.6-use-delayed-work-instead-of-write_super.patch 2015-03-02 13:40:46.000000000 +0900 @@ -0,0 +1,147 @@ +diff -Nurp a/fs/yaffs2/yaffs_linux.h b/fs/yaffs2/yaffs_linux.h +--- a/fs/yaffs2/yaffs_linux.h 2015-01-07 11:47:43.000000000 +0900 ++++ b/fs/yaffs2/yaffs_linux.h 2015-03-02 13:38:08.000000000 +0900 +@@ -18,6 +18,10 @@ + + #include "yportenv.h" + ++#ifndef YAFFS_HAS_WRITE_SUPER ++#include ++#endif ++ + struct yaffs_linux_context { + struct list_head context_list; /* List of these we have mounted */ + struct yaffs_dev *dev; +@@ -32,6 +36,9 @@ struct yaffs_linux_context { + struct task_struct *readdir_process; + unsigned mount_id; + int dirty; ++#ifndef YAFFS_HAS_WRITE_SUPER ++ struct delayed_work sb_sync_dwork; /* superblock write-out work */ ++#endif + }; + + #define yaffs_dev_to_lc(dev) ((struct yaffs_linux_context *)((dev)->os_context)) +diff -Nurp a/fs/yaffs2/yaffs_vfs.c b/fs/yaffs2/yaffs_vfs.c +--- a/fs/yaffs2/yaffs_vfs.c 2015-02-26 09:41:02.000000000 +0900 ++++ b/fs/yaffs2/yaffs_vfs.c 2015-03-02 13:35:59.000000000 +0900 +@@ -357,9 +357,72 @@ static inline void i_gid_write(struct in + } + #endif + ++ ++#ifdef YAFFS_HAS_WRITE_SUPER ++ ++static inline void yaffs_init_sb_sync_dwork(struct yaffs_LinuxContext *ylc) {} ++static inline void yaffs_cancel_sb_sync_dwork(struct super_block *sb) {} ++ ++#else /* YAFFS_HAS_WRITE_SUPER */ ++ ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) ++static void yaffs_write_super(struct super_block *sb); ++#else ++static int yaffs_write_super(struct super_block *sb); ++#endif ++ ++/* this is defined in mm/page-writeback.c */ ++extern unsigned int dirty_writeback_interval; ++ ++static inline struct yaffs_linux_context * ++yaffs_sb_to_ylc(struct super_block *sb) ++{ ++ struct yaffs_dev *ydev; ++ struct yaffs_linux_context *ylc; ++ ++ ydev = yaffs_super_to_dev(sb); ++ ylc = yaffs_dev_to_lc(ydev); ++ return ylc; ++} ++ ++static inline struct super_block *yaffs_work_to_sb(struct work_struct *work) ++{ ++ struct delayed_work *dwork; ++ struct yaffs_linux_context *ylc; ++ ++ dwork = container_of(work, struct delayed_work, work); ++ ylc = container_of(dwork, struct yaffs_linux_context, sb_sync_dwork); ++ return ylc->super; ++} ++ ++static void yaffs_sb_sync_dwork_func(struct work_struct *work) ++{ ++ struct super_block *sb = yaffs_work_to_sb(work); ++ ++ yaffs_write_super(sb); ++} ++ ++static void yaffs_init_sb_sync_dwork(struct yaffs_linux_context *ylc) ++{ ++ INIT_DELAYED_WORK(&ylc->sb_sync_dwork, yaffs_sb_sync_dwork_func); ++} ++ ++static void yaffs_cancel_sb_sync_dwork(struct super_block *sb) ++{ ++ struct yaffs_linux_context *ylc = yaffs_sb_to_ylc(sb); ++ ++ cancel_delayed_work_sync(&ylc->sb_sync_dwork); ++} ++ ++#endif /* YAFFS_HAS_WRITE_SUPER */ ++ ++ + static void yaffs_set_super_dirty_val(struct yaffs_dev *dev, int val) + { + struct yaffs_linux_context *lc = yaffs_dev_to_lc(dev); ++#ifndef YAFFS_HAS_WRITE_SUPER ++ int prev_dirty = lc->dirty; ++#endif + + if (lc) + lc->dirty = val; +@@ -372,6 +435,11 @@ static void yaffs_set_super_dirty_val(st + sb->s_dirt = val; + } + #endif ++#ifndef YAFFS_HAS_WRITE_SUPER ++ if ( val && (val != prev_dirty) ) ++ queue_delayed_work(system_long_wq, &lc->sb_sync_dwork, ++ msecs_to_jiffies( dirty_writeback_interval * 10 )); ++#endif + + } + +@@ -2255,6 +2323,8 @@ static void yaffs_put_super(struct super + + yaffs_flush_super(sb, 1); + ++ yaffs_cancel_sb_sync_dwork(sb); ++ + yaffs_deinitialise(dev); + + yaffs_gross_unlock(dev); +@@ -2570,8 +2640,6 @@ static int yaffs_do_sync_fs(struct super + return 0; + } + +- +-#ifdef YAFFS_HAS_WRITE_SUPER + #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) + static void yaffs_write_super(struct super_block *sb) + #else +@@ -2590,7 +2658,6 @@ static int yaffs_write_super(struct supe + return 0; + #endif + } +-#endif + + #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) + static int yaffs_sync_fs(struct super_block *sb, int wait) +@@ -2883,6 +2950,8 @@ static struct super_block *yaffs_interna + context->dev = dev; + context->super = sb; + ++ yaffs_init_sb_sync_dwork(context); ++ + dev->read_only = read_only; + + #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))