[Devel] [PATCH RHEL7 COMMIT] ms/xfs: convert buftarg LRU to generic code
The commit is pushed to "branch-rh7-3.10.0-514.vz7.27.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git after rh7-3.10.0-514.vz7.27.8 --> commit 6490df80cd2cc557ea7ce8520c8aa0ed5528a5f0 Author: Dmitry MonakhovDate: Wed Jan 11 14:34:37 2017 +0400 ms/xfs: convert buftarg LRU to generic code Patchset description: [7.3] rebase xfs lru patches rh7-3.10.0-514 already has 'fs-xfs-rework-buffer-dispose-list-tracking', but originally it depens on ms/xfs-convert-buftarg-LRU-to-generic, so In order to preserve original logic I've revert rhel's patch (1'st one), and reapply it later in natural order: TOC: 0001-Revert-fs-xfs-rework-buffer-dispose-list-tracking.patch 0002-ms-xfs-convert-buftarg-LRU-to-generic-code.patch 0003-From-c70ded437bb646ace0dcbf3c7989d4edeed17f7e-Mon-Se.patch [not changed] 0004-ms-xfs-rework-buffer-dispose-list-tracking.patch === This patch description: Convert the buftarg LRU to use the new generic LRU list and take advantage of the functionality it supplies to make the buffer cache shrinker node aware. Signed-off-by: Glauber Costa Signed-off-by: Dave Chinner Cc: "Theodore Ts'o" Cc: Adrian Hunter Cc: Al Viro Cc: Artem Bityutskiy Cc: Arve Hjønnevåg Cc: Carlos Maiolino Cc: Christoph Hellwig Cc: Chuck Lever Cc: Daniel Vetter Cc: David Rientjes Cc: Gleb Natapov Cc: Greg Thelen Cc: J. Bruce Fields Cc: Jan Kara Cc: Jerome Glisse Cc: John Stultz Cc: KAMEZAWA Hiroyuki Cc: Kent Overstreet Cc: Kirill A. Shutemov Cc: Marcelo Tosatti Cc: Mel Gorman Cc: Steven Whitehouse Cc: Thomas Hellstrom Cc: Trond Myklebust Signed-off-by: Andrew Morton Signed-off-by: Al Viro (cherry picked from commit e80dfa19976b884db1ac2bc5d7d6ca0a4027bd1c) https://jira.sw.ru/browse/PSBM-55577 Signed-off-by: Dmitry Monakhov --- fs/xfs/xfs_buf.c | 170 ++- fs/xfs/xfs_buf.h | 5 +- 2 files changed, 81 insertions(+), 94 deletions(-) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index c0de0e2..87a314a 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -85,20 +85,14 @@ xfs_buf_vmap_len( * The LRU takes a new reference to the buffer so that it will only be freed * once the shrinker takes the buffer off the LRU. */ -STATIC void +static void xfs_buf_lru_add( struct xfs_buf *bp) { - struct xfs_buftarg *btp = bp->b_target; - - spin_lock(>bt_lru_lock); - if (list_empty(>b_lru)) { - atomic_inc(>b_hold); - list_add_tail(>b_lru, >bt_lru); - btp->bt_lru_nr++; + if (list_lru_add(>b_target->bt_lru, >b_lru)) { bp->b_lru_flags &= ~_XBF_LRU_DISPOSE; + atomic_inc(>b_hold); } - spin_unlock(>bt_lru_lock); } /* @@ -107,24 +101,13 @@ xfs_buf_lru_add( * The unlocked check is safe here because it only occurs when there are not * b_lru_ref counts left on the inode under the pag->pag_buf_lock. it is there * to optimise the shrinker removing the buffer from the LRU and calling - * xfs_buf_free(). i.e. it removes an unnecessary round trip on the - * bt_lru_lock. + * xfs_buf_free(). */ -STATIC void +static void xfs_buf_lru_del( struct xfs_buf *bp) { - struct xfs_buftarg *btp = bp->b_target; - - if (list_empty(>b_lru)) - return; - - spin_lock(>bt_lru_lock); - if (!list_empty(>b_lru)) { - list_del_init(>b_lru); - btp->bt_lru_nr--; - } - spin_unlock(>bt_lru_lock); + list_lru_del(>b_target->bt_lru, >b_lru); } /* @@ -199,18 +182,10 @@ xfs_buf_stale( xfs_buf_ioacct_dec(bp); atomic_set(&(bp)->b_lru_ref, 0); - if (!list_empty(>b_lru)) { - struct xfs_buftarg *btp = bp->b_target; - - spin_lock(>bt_lru_lock); - if (!list_empty(>b_lru) && - !(bp->b_lru_flags & _XBF_LRU_DISPOSE)) { - list_del_init(>b_lru); - btp->bt_lru_nr--; -
[Devel] [PATCH RHEL7 COMMIT] ms/xfs-convert-buftarg-lru-to-generic-code-fix
The commit is pushed to "branch-rh7-3.10.0-514.vz7.27.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git after rh7-3.10.0-514.vz7.27.8 --> commit a438079b37e68bd54fa4942175643cc7add1e027 Author: Andrew MortonDate: Wed Jan 11 14:34:38 2017 +0400 ms/xfs-convert-buftarg-lru-to-generic-code-fix Patchset description: [7.3] rebase xfs lru patches rh7-3.10.0-514 already has 'fs-xfs-rework-buffer-dispose-list-tracking', but originally it depens on ms/xfs-convert-buftarg-LRU-to-generic, so In order to preserve original logic I've revert rhel's patch (1'st one), and reapply it later in natural order: TOC: 0001-Revert-fs-xfs-rework-buffer-dispose-list-tracking.patch 0002-ms-xfs-convert-buftarg-LRU-to-generic-code.patch 0003-From-c70ded437bb646ace0dcbf3c7989d4edeed17f7e-Mon-Se.patch [not changed] 0004-ms-xfs-rework-buffer-dispose-list-tracking.patch === This patch description: fix warnings Cc: Dave Chinner Cc: Glauber Costa Signed-off-by: Andrew Morton Signed-off-by: Al Viro (cherry picked from commit addbda40bed47d8942658fca93e14b5f1cbf009a) Signed-off-by: Vladimir Davydov https://jira.sw.ru/browse/PSBM-55577 Signed-off-by: Dmitry Monakhov --- fs/xfs/xfs_buf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 87a314a..bf933d5 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -1654,7 +1654,7 @@ xfs_buftarg_isolate( return LRU_REMOVED; } -static long +static unsigned long xfs_buftarg_shrink_scan( struct shrinker *shrink, struct shrink_control *sc) @@ -1662,7 +1662,7 @@ xfs_buftarg_shrink_scan( struct xfs_buftarg *btp = container_of(shrink, struct xfs_buftarg, bt_shrinker); LIST_HEAD(dispose); - longfreed; + unsigned long freed; unsigned long nr_to_scan = sc->nr_to_scan; freed = list_lru_walk_node(>bt_lru, sc->nid, xfs_buftarg_isolate, @@ -1678,7 +1678,7 @@ xfs_buftarg_shrink_scan( return freed; } -static long +static unsigned long xfs_buftarg_shrink_count( struct shrinker *shrink, struct shrink_control *sc) ___ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel