compat: i_mutex is replaced by i_rwsem
In v4.7(commit 9902af79), i_mutex is replaced by i_rwsem, while inode_lock() work as usual.
This patch is for drbd-9.0.
--- drbd/drbd_debugfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drbd/drbd_debugfs.c +3 -3
@@ -1074,7 +1074,7 @@ static int drbd_single_open_peer_device(struct file *file, parent = file->f_path.dentry->d_parent;if (!parent || !parent->d_inode) goto out; -mutex_lock (&parent->d_inode->i_mutex); +inode_lock (d_inode (parent));if (!simple_positive (file->f_path.dentry)) goto out_unlock;
@@ -1083,7 +1083,7 @@ static int drbd_single_open_peer_device(struct file *file,if (got_connection && got_device) {int ret; -mutex_unlock (&parent->d_inode->i_mutex); +inode_unlock (d_inode (parent)); ret =single_open (file, show, peer_device);if (ret) {kref_put (&connection->kref, drbd_destroy_connection);
@@ -1097,7 +1097,7 @@ static int drbd_single_open_peer_device(struct file *file,if (got_device)kref_put (&device->kref, drbd_destroy_device); out_unlock: -mutex_unlock (&parent->d_inode->i_mutex); +inode_unlock (d_inode (parent)); out:return -ESTALE ; }
Signature · 1 line
1.8.5.6
PATCH 1/2 compat: blk_queue_flush() is replaced
In v4.7(fe8fb75e), blk_queue_flush() switch to use blk_queue_write_cache().
--- drbd_wrappers.h | 4 ++++ tests/have_blk_queue_flush.c | 6 ++++++ 2 files changed, 10 insertions(+) create mode 100644 tests/have_blk_queue_flush.c
drbd_wrappers.h +4 -0
@@ -677,6 +677,10 @@ static inline void blk_queue_max_hw_sectors(struct request_queue *q, unsigned in#define blk_queue_max_hw_sectors (q, max) blk_queue_max_sectors(q, max)#endif +#ifndef COMPAT_HAVE_BLK_QUEUE_FLUSH +#define blk_queue_flush (q, f) blk_queue_write_cache(q, true, true) +#endif +#ifndef COMPAT_HAVE_BLK_QUEUE_MAX_SEGMENTS static inline void blk_queue_max_segments (struct request_queue *q,unsigned short max_segments) {
tests/have_blk_queue_flush.c new file +6 -0
@@ -0,0 +1,6 @@ +#include <linux/blkdev.h> + +void dummy (struct request_queue *q,unsigned int flush) +{ +blk_queue_flush (q, flush); +}
Signature · 1 line
1.8.5.6
PATCH 2/2 compat: nla_put_u64() is removed
In reply to Nick WangIn v4.7(50225243), nla_put_u64() is not used anymore, should use nla_put_u64_64bit() instead.
--- tests/have_aligned_nla_u64_pad.c | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 tests/have_aligned_nla_u64_pad.c
tests/have_aligned_nla_u64_pad.c new file +6 -0
@@ -0,0 +1,6 @@ +#include <net/netlink.h> + +void foo (void ) +{ +nla_put_u64 (NULL ,0 ,0 ); +}
Signature · 1 line
1.8.5.6
[Drbd-dev] [PATCH-drbd9] compat: align nla_put_u64
In reply to Nick WangIn v4.7(1dee3f59), nla_put_u64 is removed, using nla_put_u64_0pad for drbd instead.
Change header from linux/netlink.h to net/netlink.h for nla_put_64bit.
--- linux/genl_magic_struct.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
linux/genl_magic_struct.h +13 -1
@@ -13,7 +13,7 @@# error "you need to define GENL_MAGIC_INCLUDE_FILE before inclusion"#endif -#include <linux/netlink.h> +#include <net/netlink.h> #include <linux/genetlink.h> #include <linux/types.h> #include "compat.h"
@@ -86,9 +86,21 @@ extern void CONCAT_(GENL_MAGIC_FAMILY, _genl_unregister)(void);__field (attr_nr, attr_flag, name,NLA_U32 , __s32, \ nla_get_u32, nla_put_u32, true)#endif +#ifdef COMPAT_HAVE_ALIGNED_NLA_U64_PAD #define __u64_field (attr_nr, attr_flag, name) \ __field(attr_nr, attr_flag, name, NLA_U64, __u64, \ nla_get_u64, nla_put_u64, false) +#else + +static inline int nla_put_u64_0pad (struct sk_buff *skb,int attrtype,u64 value) +{ +return nla_put_64bit (skb, attrtype,sizeof (u64), &value,0 ); +} + +#define __u64_field (attr_nr, attr_flag, name) \ + __field(attr_nr, attr_flag, name, NLA_U64, __u64, \ + nla_get_u64, nla_put_u64_0pad, false) +#endif #define __str_field (attr_nr, attr_flag, name, maxlen) \ __array(attr_nr, attr_flag, name, NLA_NUL_STRING, char, maxlen, \ nla_strlcpy, nla_put, false)
Signature · 1 line
1.8.5.6
Lars Ellenberg
maintainerRe: [Drbd-dev] [PATCH-drbd9] compat patches
Quoted 1 line · Nick Wang
[PATCH-drbd9] compat:
i_mutexis replaced byi_rwsem
trivial, taken as is, though we need some backwards compat for some older kernels (anyways), due to
avoid error: 'inode_lock' redeclared as different kind of symbol
Quoted 3 lines
[PATCH-drbd9] compat:
blk_queue_flush()is replaced [PATCH-drbd9] compat:nla_put_u64()is removed [PATCH-drbd9] compat: alignnla_put_u64
All solved in a slightly different way.
Still thank you for using v9 on "bleeding upstream" kernels :-)
Cheers,
Lars
Signature · 6 lines
: Lars Ellenberg : LINBIT | Keeping the Digital World Running : DRBD -- Heartbeat -- Corosync -- Pacemaker : R&D, Integration, Ops, Consulting, Support DRBD® and LINBIT® are registered trademarks of LINBIT
Re: [Drbd-dev] [PATCH-drbd9] compat patches
Hi Lars,
Thanks for your review:)
Quoted 1 line
Quoted 1 line
Quoted 1 line
On 2016-6-13 at 17:19, in message <[email protected]>, Lars
Quoted 7 lines · Ellenberg
Quoted 1 line · Nick Wang
[PATCH-drbd9] compat:
i_mutexis replaced byi_rwsemtrivial, taken as is, though we need some backwards compat for some older kernels (anyways), due to
avoid error: 'inode_lock' redeclared as different kind of symbol
I thought have_inode_lock.c have already considering the old kernels, and inode_lock have already used in DRBD9.
Quoted 5 lines
Quoted 3 lines
[PATCH-drbd9] compat:
blk_queue_flush()is replaced [PATCH-drbd9] compat:nla_put_u64()is removed [PATCH-drbd9] compat: alignnla_put_u64All solved in a slightly different way.
I learnt a lot from your code and can keep learning :)
Quoted 1 line
Still thank you for using v9 on "bleeding upstream" kernels :-)
lol, sorry for the early try. Just thought it need to compatible sooner or later, hoping my work can do little help in any cases.
Best regards,
Nick