From 0aeddba8658dbe95a75d16cbc00694b01c3108df Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Thu, 16 Aug 2012 15:59:21 +0800 Subject: [PATCH] LU-1756 kernel: cleanup lustre_compat25.h 1. unused functions: ll_bdi_wb_cnt() 2. call bdi_init/bdi_destroy directly 3. call add_to_page_cache_lru directly 4. fix a typo of ll_pagevec_init Signed-off-by: Peng Tao Change-Id: I0ce799bc5aad70279a652cf911b9880abcc74194 Reviewed-on: http://review.whamcloud.com/4656 Tested-by: Hudson Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Yang Sheng --- lustre/include/linux/lustre_compat25.h | 21 +++++---------------- lustre/llite/dir.c | 6 +++--- lustre/llite/llite_lib.c | 24 ++++++++++++------------ 3 files changed, 20 insertions(+), 31 deletions(-) diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h index cc26fdb..ef54875 100644 --- a/lustre/include/linux/lustre_compat25.h +++ b/lustre/include/linux/lustre_compat25.h @@ -550,18 +550,9 @@ static inline int ll_quota_off(struct super_block *sb, int off, int remount) # define ll_vfs_dq_off(sb, remount) vfs_dq_off(sb, remount) #endif -#ifdef HAVE_BDI_INIT -#define ll_bdi_init(bdi) bdi_init(bdi) -#define ll_bdi_destroy(bdi) bdi_destroy(bdi) -#else -#define ll_bdi_init(bdi) 0 -#define ll_bdi_destroy(bdi) do { } while(0) -#endif - -#ifdef HAVE_NEW_BACKING_DEV_INFO -# define ll_bdi_wb_cnt(bdi) ((bdi).wb_cnt) -#else -# define ll_bdi_wb_cnt(bdi) 1 +#ifndef HAVE_BDI_INIT +#define bdi_init(bdi) 0 +#define bdi_destroy(bdi) do { } while (0) #endif #ifdef HAVE_BLK_QUEUE_MAX_SECTORS /* removed in rhel6 */ @@ -626,15 +617,13 @@ static inline int ll_quota_off(struct super_block *sb, int off, int remount) #endif #ifdef HAVE_ADD_TO_PAGE_CACHE_LRU -#define ll_add_to_page_cache_lru(pg, mapping, off, gfp) \ - add_to_page_cache_lru(pg, mapping, off, gfp) #define ll_pagevec_init(pv, cold) do {} while (0) #define ll_pagevec_add(pv, pg) (0) #define ll_pagevec_lru_add_file(pv) do {} while (0) #else -#define ll_add_to_page_cache_lru(pg, mapping, off, gfp) \ +#define add_to_page_cache_lru(pg, mapping, off, gfp) \ add_to_page_cache(pg, mapping, off, gfp) -#define ll_pagevec_init(pv, cold) pagevec_init(&lru_pvec, cold); +#define ll_pagevec_init(pv, cold) pagevec_init(pv, cold); #define ll_pagevec_add(pv, pg) \ ({ \ int __ret; \ diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c index ed8e1c7..590ce5f 100644 --- a/lustre/llite/dir.c +++ b/lustre/llite/dir.c @@ -224,9 +224,9 @@ static int ll_dir_filler(void *_hash, struct page *page0) offset = hash_x_index(hash, hash64); - prefetchw(&page->flags); - ret = ll_add_to_page_cache_lru(page, inode->i_mapping, offset, - GFP_KERNEL); + prefetchw(&page->flags); + ret = add_to_page_cache_lru(page, inode->i_mapping, offset, + GFP_KERNEL); if (ret == 0) { unlock_page(page); if (ll_pagevec_add(&lru_pvec, page) == 0) diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 3cc5d7a..f0e131ac 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -986,14 +986,14 @@ int ll_fill_super(struct super_block *sb, struct vfsmount *mnt) if (err) GOTO(out_free, err); - err = ll_bdi_init(&lsi->lsi_bdi); - if (err) - GOTO(out_free, err); - lsi->lsi_flags |= LSI_BDI_INITIALIZED; - lsi->lsi_bdi.capabilities = BDI_CAP_MAP_COPY; - err = ll_bdi_register(&lsi->lsi_bdi); - if (err) - GOTO(out_free, err); + err = bdi_init(&lsi->lsi_bdi); + if (err) + GOTO(out_free, err); + lsi->lsi_flags |= LSI_BDI_INITIALIZED; + lsi->lsi_bdi.capabilities = BDI_CAP_MAP_COPY; + err = ll_bdi_register(&lsi->lsi_bdi); + if (err) + GOTO(out_free, err); #ifdef HAVE_SB_BDI sb->s_bdi = &lsi->lsi_bdi; @@ -1102,10 +1102,10 @@ void ll_put_super(struct super_block *sb) if (profilenm) class_del_profile(profilenm); - if (lsi->lsi_flags & LSI_BDI_INITIALIZED) { - ll_bdi_destroy(&lsi->lsi_bdi); - lsi->lsi_flags &= ~LSI_BDI_INITIALIZED; - } + if (lsi->lsi_flags & LSI_BDI_INITIALIZED) { + bdi_destroy(&lsi->lsi_bdi); + lsi->lsi_flags &= ~LSI_BDI_INITIALIZED; + } ll_free_sbi(sb); lsi->lsi_llsbi = NULL; -- 1.8.3.1