From 603fd5af50731b2c805fbcfe30dfff7ff8737987 Mon Sep 17 00:00:00 2001 From: Dennis Dalessandro Date: Mon, 30 Dec 2013 10:09:31 -0500 Subject: [PATCH] IB/qib/ipath: patches from 3.5 carried forward Signed-off-by: Dennis Dalessandro --- ...-qib-backport-qib_fs.c-before-2.6.35.patch | 86 +++++++++++++++++++ ...qib-backport-3.2-for-pinned_vm-field.patch | 36 ++++++++ ...path-backport-qib_fs.c-before-2.6.35.patch | 80 +++++++++++++++++ ...ath-backport-3.2-for-pinned_vm-field.patch | 48 +++++++++++ 4 files changed, 250 insertions(+) create mode 100644 patches/0006-IB-qib-backport-qib_fs.c-before-2.6.35.patch create mode 100644 patches/0007-IB-qib-backport-3.2-for-pinned_vm-field.patch create mode 100644 patches/0008-IB-ipath-backport-qib_fs.c-before-2.6.35.patch create mode 100644 patches/0009-IB-ipath-backport-3.2-for-pinned_vm-field.patch diff --git a/patches/0006-IB-qib-backport-qib_fs.c-before-2.6.35.patch b/patches/0006-IB-qib-backport-qib_fs.c-before-2.6.35.patch new file mode 100644 index 0000000..2bab478 --- /dev/null +++ b/patches/0006-IB-qib-backport-qib_fs.c-before-2.6.35.patch @@ -0,0 +1,86 @@ +From: Mike Marciniszyn +Subject: [PATCH] IB/qib: backport qib_fs.c before 2.6.35 + +Signed-off-by: Mike Marciniszyn +--- + drivers/infiniband/hw/qib/qib_fs.c | 29 +++++++++++++++++++++++++++++ + 1 files changed, 29 insertions(+), 0 deletions(-) + +diff --git a/drivers/infiniband/hw/qib/qib_fs.c b/drivers/infiniband/hw/qib/qib_fs.c +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/infiniband/hw/qib/qib_fs.c ++++ b/drivers/infiniband/hw/qib/qib_fs.c +@@ -58,7 +58,9 @@ static int qibfs_mknod(struct inode *dir, struct dentry *dentry, + goto bail; + } + ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36)) + inode->i_ino = get_next_ino(); ++#endif + inode->i_mode = mode; + inode->i_uid = 0; + inode->i_gid = 0; +@@ -453,14 +455,27 @@ static int remove_file(struct dentry *parent, char *name) + goto bail; + } + ++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,36)) ++ spin_lock(&dcache_lock); ++#endif + spin_lock(&tmp->d_lock); + if (!(d_unhashed(tmp) && tmp->d_inode)) { ++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,36)) ++ dget_locked(tmp); ++#else + dget_dlock(tmp); ++#endif + __d_drop(tmp); + spin_unlock(&tmp->d_lock); ++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,36)) ++ spin_unlock(&dcache_lock); ++#endif + simple_unlink(parent->d_inode, tmp); + } else { + spin_unlock(&tmp->d_lock); ++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,36)) ++ spin_unlock(&dcache_lock); ++#endif + } + + ret = 0; +@@ -552,6 +567,7 @@ bail: + return ret; + } + ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36)) + static struct dentry *qibfs_mount(struct file_system_type *fs_type, int flags, + const char *dev_name, void *data) + { +@@ -559,6 +575,15 @@ static struct dentry *qibfs_mount(struct file_system_type *fs_type, int flags, + ret = mount_single(fs_type, flags, data, qibfs_fill_super); + if (!IS_ERR(ret)) + qib_super = ret->d_sb; ++#else ++static int qibfs_get_sb(struct file_system_type *fs_type, int flags, ++ const char *dev_name, void *data, struct vfsmount *mnt) ++{ ++ int ret = get_sb_single(fs_type, flags, data, ++ qibfs_fill_super, mnt); ++ if (ret >= 0) ++ qib_super = mnt->mnt_sb; ++#endif + return ret; + } + +@@ -600,7 +625,11 @@ int qibfs_remove(struct qib_devdata *dd) + static struct file_system_type qibfs_fs_type = { + .owner = THIS_MODULE, + .name = "ipathfs", ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36)) + .mount = qibfs_mount, ++#else ++ .get_sb = qibfs_get_sb, ++#endif + .kill_sb = qibfs_kill_super, + }; + diff --git a/patches/0007-IB-qib-backport-3.2-for-pinned_vm-field.patch b/patches/0007-IB-qib-backport-3.2-for-pinned_vm-field.patch new file mode 100644 index 0000000..a57d331 --- /dev/null +++ b/patches/0007-IB-qib-backport-3.2-for-pinned_vm-field.patch @@ -0,0 +1,36 @@ +From: Mike Marciniszyn +Subject: [PATCH] IB/qib: backport < 3.2 for pinned_vm field + +Signed-off-by: Mike Marciniszyn +--- + drivers/infiniband/hw/qib/qib_user_pages.c | 8 ++++++++ + 1 files changed, 8 insertions(+), 0 deletions(-) + +diff --git a/drivers/infiniband/hw/qib/qib_user_pages.c b/drivers/infiniband/hw/qib/qib_user_pages.c +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/infiniband/hw/qib/qib_user_pages.c ++++ b/drivers/infiniband/hw/qib/qib_user_pages.c +@@ -74,7 +74,11 @@ static int __qib_get_user_pages(unsigned long start_page, size_t num_pages, + goto bail_release; + } + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) + current->mm->pinned_vm += num_pages; ++#else ++ current->mm->locked_vm += num_pages; ++#endif + + ret = 0; + goto bail; +@@ -151,7 +155,11 @@ void qib_release_user_pages(struct page **p, size_t num_pages) + __qib_release_user_pages(p, num_pages, 1); + + if (current->mm) { ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) + current->mm->pinned_vm -= num_pages; ++#else ++ current->mm->locked_vm -= num_pages; ++#endif + up_write(¤t->mm->mmap_sem); + } + } diff --git a/patches/0008-IB-ipath-backport-qib_fs.c-before-2.6.35.patch b/patches/0008-IB-ipath-backport-qib_fs.c-before-2.6.35.patch new file mode 100644 index 0000000..b751b78 --- /dev/null +++ b/patches/0008-IB-ipath-backport-qib_fs.c-before-2.6.35.patch @@ -0,0 +1,80 @@ +From: Mike Marciniszyn +Subject: [PATCH] IB/ipath: backport qib_fs.c before 2.6.35 + +Signed-off-by: Mike Marciniszyn +--- + drivers/infiniband/hw/ipath/ipath_fs.c | 26 ++++++++++++++++++++++++++ + 1 files changed, 26 insertions(+), 0 deletions(-) + +diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/infiniband/hw/ipath/ipath_fs.c ++++ b/drivers/infiniband/hw/ipath/ipath_fs.c +@@ -57,7 +57,9 @@ static int ipathfs_mknod(struct inode *dir, struct dentry *dentry, + goto bail; + } + ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36)) + inode->i_ino = get_next_ino(); ++#endif + inode->i_mode = mode; + inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; + inode->i_private = data; +@@ -277,11 +279,21 @@ static int remove_file(struct dentry *parent, char *name) + goto bail; + } + ++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,36)) ++ spin_lock(&dcache_lock); ++#endif + spin_lock(&tmp->d_lock); + if (!(d_unhashed(tmp) && tmp->d_inode)) { ++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,36)) ++ dget_locked(tmp); ++#else + dget_dlock(tmp); ++#endif + __d_drop(tmp); + spin_unlock(&tmp->d_lock); ++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,36)) ++ spin_unlock(&dcache_lock); ++#endif + simple_unlink(parent->d_inode, tmp); + } else + spin_unlock(&tmp->d_lock); +@@ -358,6 +370,7 @@ bail: + return ret; + } + ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36)) + static struct dentry *ipathfs_mount(struct file_system_type *fs_type, + int flags, const char *dev_name, void *data) + { +@@ -365,6 +378,15 @@ static struct dentry *ipathfs_mount(struct file_system_type *fs_type, + ret = mount_single(fs_type, flags, data, ipathfs_fill_super); + if (!IS_ERR(ret)) + ipath_super = ret->d_sb; ++#else ++static int ipathfs_get_sb(struct file_system_type *fs_type, int flags, ++ const char *dev_name, void *data, struct vfsmount *mnt) ++{ ++ int ret = get_sb_single(fs_type, flags, data, ++ ipathfs_fill_super, mnt); ++ if (ret >= 0) ++ ipath_super = mnt->mnt_sb; ++#endif + return ret; + } + +@@ -407,7 +429,11 @@ bail: + static struct file_system_type ipathfs_fs_type = { + .owner = THIS_MODULE, + .name = "ipathfs", ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36)) + .mount = ipathfs_mount, ++#else ++ .get_sb = ipathfs_get_sb, ++#endif + .kill_sb = ipathfs_kill_super, + }; + diff --git a/patches/0009-IB-ipath-backport-3.2-for-pinned_vm-field.patch b/patches/0009-IB-ipath-backport-3.2-for-pinned_vm-field.patch new file mode 100644 index 0000000..d8d2291 --- /dev/null +++ b/patches/0009-IB-ipath-backport-3.2-for-pinned_vm-field.patch @@ -0,0 +1,48 @@ +From: Mike Marciniszyn +Subject: [PATCH] IB/ipath: backport < 3.2 for pinned_vm field + +Signed-off-by: Mike Marciniszyn +--- + drivers/infiniband/hw/ipath/ipath_user_pages.c | 12 ++++++++++++ + 1 files changed, 12 insertions(+), 0 deletions(-) + +diff --git a/drivers/infiniband/hw/ipath/ipath_user_pages.c b/drivers/infiniband/hw/ipath/ipath_user_pages.c +index xxxxxxx..xxxxxxx xxxxxx +--- a/drivers/infiniband/hw/ipath/ipath_user_pages.c ++++ b/drivers/infiniband/hw/ipath/ipath_user_pages.c +@@ -79,7 +79,11 @@ static int __ipath_get_user_pages(unsigned long start_page, size_t num_pages, + goto bail_release; + } + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) + current->mm->pinned_vm += num_pages; ++#else ++ current->mm->locked_vm += num_pages; ++#endif + + ret = 0; + goto bail; +@@ -178,7 +182,11 @@ void ipath_release_user_pages(struct page **p, size_t num_pages) + + __ipath_release_user_pages(p, num_pages, 1); + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) + current->mm->pinned_vm -= num_pages; ++#else ++ current->mm->locked_vm -= num_pages; ++#endif + + up_write(¤t->mm->mmap_sem); + } +@@ -195,7 +203,11 @@ static void user_pages_account(struct work_struct *_work) + container_of(_work, struct ipath_user_pages_work, work); + + down_write(&work->mm->mmap_sem); ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) + work->mm->pinned_vm -= work->num_pages; ++#else ++ work->mm->locked_vm -= work->num_pages; ++#endif + up_write(&work->mm->mmap_sem); + mmput(work->mm); + kfree(work); -- 2.41.0