From 472fe13982952c9ccad969a996c054f9cf643847 Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Thu, 16 Aug 2012 15:59:21 +0800 Subject: [PATCH 1/1] 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 5. remove QUOTA_OK/NO_QUOTA. They are defined in libcfs Signed-off-by: Peng Tao Change-Id: I9953dabbc758e6fb7a3d0649bdc64ba1455efb99 Reviewed-on: http://review.whamcloud.com/3689 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Yang Sheng --- lustre/include/liblustre.h | 2 +- lustre/include/linux/lustre_compat25.h | 28 +++++----------------------- lustre/llite/dir.c | 6 +++--- lustre/llite/llite_lib.c | 24 ++++++++++++------------ 4 files changed, 21 insertions(+), 39 deletions(-) diff --git a/lustre/include/liblustre.h b/lustre/include/liblustre.h index bf34f04..93432b6 100644 --- a/lustre/include/liblustre.h +++ b/lustre/include/liblustre.h @@ -420,7 +420,7 @@ typedef struct file_lock { /* quota */ #define QUOTA_OK 0 -#define NO_QUOTA 1 +#define NO_QUOTA (-EDQUOT) /* ACL */ typedef struct { diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h index f872a1e..2921bfb 100644 --- a/lustre/include/linux/lustre_compat25.h +++ b/lustre/include/linux/lustre_compat25.h @@ -587,18 +587,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 */ @@ -635,15 +626,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; \ @@ -659,13 +648,6 @@ static inline int ll_quota_off(struct super_block *sb, int off, int remount) #define HAVE_NODE_TO_CPUMASK #endif -#ifndef QUOTA_OK -# define QUOTA_OK 0 -#endif -#ifndef NO_QUOTA -# define NO_QUOTA (-EDQUOT) -#endif - #if !defined(_ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_) && !defined(ext2_set_bit) # define ext2_set_bit __test_and_set_bit_le # define ext2_clear_bit __test_and_clear_bit_le diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c index 80fe011..7317ee0 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 c9ee262..126efaa 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -987,14 +987,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; @@ -1103,10 +1103,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