* [PATCH v3 0/4] Staging: lustre: Use static inline functions instead of macros
@ 2015-10-17 16:13 Ksenija Stanojevic
2015-10-17 16:17 ` [PATCH v3 1/4] Staging: lustre: include: Move function prototypes Ksenija Stanojevic
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Ksenija Stanojevic @ 2015-10-17 16:13 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Ksenija Stanojevic
Convert macros class_export_lock_get and class_export_lock_put into static
inline functions and also remove some unused macros.
Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
Changes in v3:
- change commit message
- add space in signed-off-by line
Changes in v2:
- be more specific in commit message
Ksenija Stanojevic (4):
Staging: lustre: include: Move function prototypes
Staging: lustre: include: Convert macro class_export_lock_get into
static inline function
Staging: lustre: include: Convert macro class_export_lock_put into
static inline function
Staging: lustre: include : Remove unused macros
drivers/staging/lustre/lustre/include/obd_class.h | 90 ++++++++++-------------
1 file changed, 38 insertions(+), 52 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 1/4] Staging: lustre: include: Move function prototypes
2015-10-17 16:13 [PATCH v3 0/4] Staging: lustre: Use static inline functions instead of macros Ksenija Stanojevic
@ 2015-10-17 16:17 ` Ksenija Stanojevic
2015-10-17 16:18 ` [PATCH v3 2/4] Staging: lustre: include: Convert macro class_export_lock_get into static inline function Ksenija Stanojevic
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Ksenija Stanojevic @ 2015-10-17 16:17 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Ksenija Stanojevic
Functions:
struct obd_export *class_export_get(struct obd_export *exp);
void class_export_put(struct obd_export *exp)
are being used in macros that are converted into static inline
functions, therefore move function prototypes to avoid build
error in later patches.
Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
---
Changes in v3:
- change commit message
- add space in signed-off-by line
Changes in v2:
- be more specific in commit message
drivers/staging/lustre/lustre/include/obd_class.h | 37 ++++++++++++-----------
1 file changed, 19 insertions(+), 18 deletions(-)
diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h
index 82f1a26..4c2076e 100644
--- a/drivers/staging/lustre/lustre/include/obd_class.h
+++ b/drivers/staging/lustre/lustre/include/obd_class.h
@@ -189,6 +189,25 @@ extern void (*class_export_dump_hook)(struct obd_export *);
#endif
+/* genops.c */
+struct obd_export *class_export_get(struct obd_export *exp);
+void class_export_put(struct obd_export *exp);
+struct obd_export *class_new_export(struct obd_device *obddev,
+ struct obd_uuid *cluuid);
+void class_unlink_export(struct obd_export *exp);
+
+struct obd_import *class_import_get(struct obd_import *);
+void class_import_put(struct obd_import *);
+struct obd_import *class_new_import(struct obd_device *obd);
+void class_destroy_import(struct obd_import *exp);
+
+void class_put_type(struct obd_type *type);
+int class_connect(struct lustre_handle *conn, struct obd_device *obd,
+ struct obd_uuid *cluuid);
+int class_disconnect(struct obd_export *exp);
+void class_fail_export(struct obd_export *exp);
+int class_manual_cleanup(struct obd_device *obd);
+
static inline void class_export_rpc_inc(struct obd_export *exp)
{
atomic_inc(&(exp)->exp_rpc_count);
@@ -240,24 +259,6 @@ static inline void class_export_rpc_dec(struct obd_export *exp)
class_export_put(exp); \
})
-/* genops.c */
-struct obd_export *class_export_get(struct obd_export *exp);
-void class_export_put(struct obd_export *exp);
-struct obd_export *class_new_export(struct obd_device *obddev,
- struct obd_uuid *cluuid);
-void class_unlink_export(struct obd_export *exp);
-
-struct obd_import *class_import_get(struct obd_import *);
-void class_import_put(struct obd_import *);
-struct obd_import *class_new_import(struct obd_device *obd);
-void class_destroy_import(struct obd_import *exp);
-
-void class_put_type(struct obd_type *type);
-int class_connect(struct lustre_handle *conn, struct obd_device *obd,
- struct obd_uuid *cluuid);
-int class_disconnect(struct obd_export *exp);
-void class_fail_export(struct obd_export *exp);
-int class_manual_cleanup(struct obd_device *obd);
static inline enum obd_option exp_flags_from_obd(struct obd_device *obd)
{
return ((obd->obd_fail ? OBD_OPT_FAILOVER : 0) |
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3 2/4] Staging: lustre: include: Convert macro class_export_lock_get into static inline function
2015-10-17 16:13 [PATCH v3 0/4] Staging: lustre: Use static inline functions instead of macros Ksenija Stanojevic
2015-10-17 16:17 ` [PATCH v3 1/4] Staging: lustre: include: Move function prototypes Ksenija Stanojevic
@ 2015-10-17 16:18 ` Ksenija Stanojevic
2015-10-17 16:19 ` [PATCH v3 3/4] Staging: lustre: include: Convert macro class_export_lock_put " Ksenija Stanojevic
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Ksenija Stanojevic @ 2015-10-17 16:18 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Ksenija Stanojevic
Static inline functions are preferred over macros. This change is safe
because the types of arguments at all the call sites are same.
Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
---
Changes in v3:
- add space in signed-off-by line
Changes in v2:
- nothing
drivers/staging/lustre/lustre/include/obd_class.h | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h
index 4c2076e..5a57876 100644
--- a/drivers/staging/lustre/lustre/include/obd_class.h
+++ b/drivers/staging/lustre/lustre/include/obd_class.h
@@ -223,14 +223,15 @@ static inline void class_export_rpc_dec(struct obd_export *exp)
(exp), atomic_read(&(exp)->exp_rpc_count));
}
-#define class_export_lock_get(exp, lock) \
-({ \
- atomic_inc(&(exp)->exp_locks_count); \
- __class_export_add_lock_ref(exp, lock); \
- CDEBUG(D_INFO, "lock GETting export %p : new locks_count %d\n", \
- (exp), atomic_read(&(exp)->exp_locks_count)); \
- class_export_get(exp); \
-})
+static inline struct obd_export *class_export_lock_get(struct obd_export *exp,
+ struct ldlm_lock *lock)
+{
+ atomic_inc(&(exp)->exp_locks_count);
+ __class_export_add_lock_ref(exp, lock);
+ CDEBUG(D_INFO, "lock GETting export %p : new locks_count %d\n",
+ (exp), atomic_read(&(exp)->exp_locks_count));
+ return class_export_get(exp);
+}
#define class_export_lock_put(exp, lock) \
({ \
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3 3/4] Staging: lustre: include: Convert macro class_export_lock_put into static inline function
2015-10-17 16:13 [PATCH v3 0/4] Staging: lustre: Use static inline functions instead of macros Ksenija Stanojevic
2015-10-17 16:17 ` [PATCH v3 1/4] Staging: lustre: include: Move function prototypes Ksenija Stanojevic
2015-10-17 16:18 ` [PATCH v3 2/4] Staging: lustre: include: Convert macro class_export_lock_get into static inline function Ksenija Stanojevic
@ 2015-10-17 16:19 ` Ksenija Stanojevic
2015-10-17 16:21 ` [PATCH v3 4/4] Staging: lustre: include : Remove unused macros Ksenija Stanojevic
2015-10-19 13:27 ` [Outreachy kernel] [PATCH v3 0/4] Staging: lustre: Use static inline functions instead of macros Arnd Bergmann
4 siblings, 0 replies; 7+ messages in thread
From: Ksenija Stanojevic @ 2015-10-17 16:19 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Ksenija Stanojevic
Static inline functions are preferred over macros. This change is safe
because the types of arguments at all the call sites are same.
Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
---
Changes in v3:
- add space in signed-off-by line
Changes in v2:
- nothing
drivers/staging/lustre/lustre/include/obd_class.h | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h
index 5a57876..4871b6a 100644
--- a/drivers/staging/lustre/lustre/include/obd_class.h
+++ b/drivers/staging/lustre/lustre/include/obd_class.h
@@ -233,15 +233,16 @@ static inline struct obd_export *class_export_lock_get(struct obd_export *exp,
return class_export_get(exp);
}
-#define class_export_lock_put(exp, lock) \
-({ \
- LASSERT_ATOMIC_POS(&exp->exp_locks_count); \
- atomic_dec(&(exp)->exp_locks_count); \
- __class_export_del_lock_ref(exp, lock); \
- CDEBUG(D_INFO, "lock PUTting export %p : new locks_count %d\n", \
- (exp), atomic_read(&(exp)->exp_locks_count)); \
- class_export_put(exp); \
-})
+static inline void class_export_lock_put(struct obd_export *exp,
+ struct ldlm_lock *lock)
+{
+ LASSERT_ATOMIC_POS(&exp->exp_locks_count);
+ atomic_dec(&(exp)->exp_locks_count);
+ __class_export_del_lock_ref(exp, lock);
+ CDEBUG(D_INFO, "lock PUTting export %p : new locks_count %d\n",
+ (exp), atomic_read(&(exp)->exp_locks_count));
+ class_export_put(exp);
+}
#define class_export_cb_get(exp) \
({ \
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3 4/4] Staging: lustre: include : Remove unused macros
2015-10-17 16:13 [PATCH v3 0/4] Staging: lustre: Use static inline functions instead of macros Ksenija Stanojevic
` (2 preceding siblings ...)
2015-10-17 16:19 ` [PATCH v3 3/4] Staging: lustre: include: Convert macro class_export_lock_put " Ksenija Stanojevic
@ 2015-10-17 16:21 ` Ksenija Stanojevic
2015-10-19 13:27 ` [Outreachy kernel] [PATCH v3 0/4] Staging: lustre: Use static inline functions instead of macros Arnd Bergmann
4 siblings, 0 replies; 7+ messages in thread
From: Ksenija Stanojevic @ 2015-10-17 16:21 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Ksenija Stanojevic
These macro are not used anymore, therefore remove them.
Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
---
Changes in v3:
- add space in signed-off-by line
Changes in v2:
- nothing
drivers/staging/lustre/lustre/include/obd_class.h | 17 -----------------
1 file changed, 17 deletions(-)
diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h
index 4871b6a..53c255c 100644
--- a/drivers/staging/lustre/lustre/include/obd_class.h
+++ b/drivers/staging/lustre/lustre/include/obd_class.h
@@ -244,23 +244,6 @@ static inline void class_export_lock_put(struct obd_export *exp,
class_export_put(exp);
}
-#define class_export_cb_get(exp) \
-({ \
- atomic_inc(&(exp)->exp_cb_count); \
- CDEBUG(D_INFO, "callback GETting export %p : new cb_count %d\n",\
- (exp), atomic_read(&(exp)->exp_cb_count)); \
- class_export_get(exp); \
-})
-
-#define class_export_cb_put(exp) \
-({ \
- LASSERT_ATOMIC_POS(&exp->exp_cb_count); \
- atomic_dec(&(exp)->exp_cb_count); \
- CDEBUG(D_INFO, "callback PUTting export %p : new cb_count %d\n",\
- (exp), atomic_read(&(exp)->exp_cb_count)); \
- class_export_put(exp); \
-})
-
static inline enum obd_option exp_flags_from_obd(struct obd_device *obd)
{
return ((obd->obd_fail ? OBD_OPT_FAILOVER : 0) |
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Outreachy kernel] [PATCH v3 0/4] Staging: lustre: Use static inline functions instead of macros
2015-10-17 16:13 [PATCH v3 0/4] Staging: lustre: Use static inline functions instead of macros Ksenija Stanojevic
` (3 preceding siblings ...)
2015-10-17 16:21 ` [PATCH v3 4/4] Staging: lustre: include : Remove unused macros Ksenija Stanojevic
@ 2015-10-19 13:27 ` Arnd Bergmann
2015-10-19 15:16 ` Ksenija Stanojević
4 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2015-10-19 13:27 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Ksenija Stanojevic
On Saturday 17 October 2015 18:13:15 Ksenija Stanojevic wrote:
> Convert macros class_export_lock_get and class_export_lock_put into static
> inline functions and also remove some unused macros.
>
> Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
Whole series,
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Outreachy kernel] [PATCH v3 0/4] Staging: lustre: Use static inline functions instead of macros
2015-10-19 13:27 ` [Outreachy kernel] [PATCH v3 0/4] Staging: lustre: Use static inline functions instead of macros Arnd Bergmann
@ 2015-10-19 15:16 ` Ksenija Stanojević
0 siblings, 0 replies; 7+ messages in thread
From: Ksenija Stanojević @ 2015-10-19 15:16 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: outreachy-kernel
Hi Arnd,
On Mon, Oct 19, 2015 at 3:27 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Saturday 17 October 2015 18:13:15 Ksenija Stanojevic wrote:
>> Convert macros class_export_lock_get and class_export_lock_put into static
>> inline functions and also remove some unused macros.
>>
>> Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
>
> Whole series,
>
> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Greg already merged these patches
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-10-19 15:16 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-17 16:13 [PATCH v3 0/4] Staging: lustre: Use static inline functions instead of macros Ksenija Stanojevic
2015-10-17 16:17 ` [PATCH v3 1/4] Staging: lustre: include: Move function prototypes Ksenija Stanojevic
2015-10-17 16:18 ` [PATCH v3 2/4] Staging: lustre: include: Convert macro class_export_lock_get into static inline function Ksenija Stanojevic
2015-10-17 16:19 ` [PATCH v3 3/4] Staging: lustre: include: Convert macro class_export_lock_put " Ksenija Stanojevic
2015-10-17 16:21 ` [PATCH v3 4/4] Staging: lustre: include : Remove unused macros Ksenija Stanojevic
2015-10-19 13:27 ` [Outreachy kernel] [PATCH v3 0/4] Staging: lustre: Use static inline functions instead of macros Arnd Bergmann
2015-10-19 15:16 ` Ksenija Stanojević
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.