From: yangsheng Date: Mon, 5 Dec 2011 16:17:17 +0000 (+0800) Subject: LU-506 kernel: FC15 - blkdev_get_by_dev() used instead of open_by_devnum(). X-Git-Tag: 2.1.53~45 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;ds=sidebyside;h=f12b088ace79fa518bdfc8bdb9b462b8165d715e;p=fs%2Flustre-release.git LU-506 kernel: FC15 - blkdev_get_by_dev() used instead of open_by_devnum(). Signed-off-by: Yang Sheng Change-Id: I9d633ba5c3004fd23de9522ebc8089792b96ed2c Reviewed-on: http://review.whamcloud.com/1800 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin --- diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 15c8a99..f9f9790 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -2058,6 +2058,18 @@ LB_LINUX_TRY_COMPILE([ ]) # +# 2.6.38 export blkdev_get_by_dev +# +AC_DEFUN([LC_BLKDEV_GET_BY_DEV], +[LB_CHECK_SYMBOL_EXPORT([blkdev_get_by_dev], +[fs/block_dev.c],[ +AC_DEFINE(HAVE_BLKDEV_GET_BY_DEV, 1, + [blkdev_get_by_dev is exported by the kernel]) +],[ +]) +]) + +# # 2.6.39 remove unplug_fn from request_queue. # AC_DEFUN([LC_REQUEST_QUEUE_UNPLUG_FN], @@ -2069,7 +2081,7 @@ LB_LINUX_TRY_COMPILE([ memset(rq.unplug_fn, 0, sizeof(rq.unplug_fn)); ],[ AC_DEFINE(HAVE_REQUEST_QUEUE_UNPLUG_FN, 1, - [request_queue has unplug_fn field]), + [request_queue has unplug_fn field]), AC_MSG_RESULT([yes]) ],[ AC_MSG_RESULT([no]) @@ -2227,6 +2239,9 @@ AC_DEFUN([LC_PROG_LINUX], LC_BLK_QUEUE_MAX_SECTORS LC_BLK_QUEUE_MAX_SEGMENTS + # 2.6.38 + LC_BLKDEV_GET_BY_DEV + # 2.6.39 LC_REQUEST_QUEUE_UNPLUG_FN diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h index 5912064..01f5e4f 100644 --- a/lustre/include/linux/lustre_compat25.h +++ b/lustre/include/linux/lustre_compat25.h @@ -817,6 +817,10 @@ static inline int ll_quota_off(struct super_block *sb, int off, int remount) #define blk_queue_max_hw_sectors(q, sect) blk_queue_max_sectors(q, sect) #endif +#ifndef HAVE_BLKDEV_GET_BY_DEV +# define blkdev_get_by_dev(dev, mode, holder) open_by_devnum(dev, mode) +#endif + #ifndef HAVE_REQUEST_QUEUE_LIMITS #define queue_max_sectors(rq) ((rq)->max_sectors) #define queue_max_hw_sectors(rq) ((rq)->max_hw_sectors) diff --git a/lustre/llite/lloop.c b/lustre/llite/lloop.c index 952d144..a0ebd22 100644 --- a/lustre/llite/lloop.c +++ b/lustre/llite/lloop.c @@ -747,7 +747,7 @@ static enum llioc_iter lloop_ioctl(struct inode *unused, struct file *file, if (put_user((long)old_encode_dev(dev), (long*)arg)) GOTO(out, err = -EFAULT); - bdev = open_by_devnum(dev, file->f_mode); + bdev = blkdev_get_by_dev(dev, file->f_mode, NULL); if (IS_ERR(bdev)) GOTO(out, err = PTR_ERR(bdev));