* [PATCH 0/4]Staging: lustre: Use static inline functions instead of macros
@ 2015-10-14 21:04 Ksenija Stanojevic
2015-10-14 21:06 ` [PATCH 1/4] Staging: lustre: include: Move function prototypes Ksenija Stanojevic
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Ksenija Stanojevic @ 2015-10-14 21:04 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>
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] 10+ messages in thread
* [PATCH 1/4] Staging: lustre: include: Move function prototypes
2015-10-14 21:04 [PATCH 0/4]Staging: lustre: Use static inline functions instead of macros Ksenija Stanojevic
@ 2015-10-14 21:06 ` Ksenija Stanojevic
2015-10-17 5:24 ` [Outreachy kernel] " Greg KH
2015-10-14 21:07 ` [PATCH 2/4] Staging: lustre: include: Convert macro class_export_lock_get into static inline function Ksenija Stanojevic
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: Ksenija Stanojevic @ 2015-10-14 21:06 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Ksenija Stanojevic
Function prototypes need to be declared before functions are being
used.
Signed-off-by: Ksenija Stanojevic<ksenija.stanojevic@gmail.com>
---
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] 10+ messages in thread
* [PATCH 2/4] Staging: lustre: include: Convert macro class_export_lock_get into static inline function
2015-10-14 21:04 [PATCH 0/4]Staging: lustre: Use static inline functions instead of macros Ksenija Stanojevic
2015-10-14 21:06 ` [PATCH 1/4] Staging: lustre: include: Move function prototypes Ksenija Stanojevic
@ 2015-10-14 21:07 ` Ksenija Stanojevic
2015-10-17 5:28 ` [Outreachy kernel] " Greg KH
2015-10-14 21:08 ` [PATCH 3/4] Staging: lustre: include: Convert macro class_export_lock_put " Ksenija Stanojevic
2015-10-14 21:09 ` [PATCH 4/4] Staging: lustre: include : Remove unused macros Ksenija Stanojevic
3 siblings, 1 reply; 10+ messages in thread
From: Ksenija Stanojevic @ 2015-10-14 21:07 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>
---
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] 10+ messages in thread
* [PATCH 3/4] Staging: lustre: include: Convert macro class_export_lock_put into static inline function
2015-10-14 21:04 [PATCH 0/4]Staging: lustre: Use static inline functions instead of macros Ksenija Stanojevic
2015-10-14 21:06 ` [PATCH 1/4] Staging: lustre: include: Move function prototypes Ksenija Stanojevic
2015-10-14 21:07 ` [PATCH 2/4] Staging: lustre: include: Convert macro class_export_lock_get into static inline function Ksenija Stanojevic
@ 2015-10-14 21:08 ` Ksenija Stanojevic
2015-10-14 21:09 ` [PATCH 4/4] Staging: lustre: include : Remove unused macros Ksenija Stanojevic
3 siblings, 0 replies; 10+ messages in thread
From: Ksenija Stanojevic @ 2015-10-14 21:08 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>
---
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] 10+ messages in thread
* [PATCH 4/4] Staging: lustre: include : Remove unused macros
2015-10-14 21:04 [PATCH 0/4]Staging: lustre: Use static inline functions instead of macros Ksenija Stanojevic
` (2 preceding siblings ...)
2015-10-14 21:08 ` [PATCH 3/4] Staging: lustre: include: Convert macro class_export_lock_put " Ksenija Stanojevic
@ 2015-10-14 21:09 ` Ksenija Stanojevic
3 siblings, 0 replies; 10+ messages in thread
From: Ksenija Stanojevic @ 2015-10-14 21:09 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>
---
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] 10+ messages in thread
* Re: [Outreachy kernel] [PATCH 1/4] Staging: lustre: include: Move function prototypes
2015-10-14 21:06 ` [PATCH 1/4] Staging: lustre: include: Move function prototypes Ksenija Stanojevic
@ 2015-10-17 5:24 ` Greg KH
2015-10-17 7:09 ` Ksenija Stanojević
0 siblings, 1 reply; 10+ messages in thread
From: Greg KH @ 2015-10-17 5:24 UTC (permalink / raw)
To: Ksenija Stanojevic; +Cc: outreachy-kernel
On Wed, Oct 14, 2015 at 11:06:28PM +0200, Ksenija Stanojevic wrote:
> Function prototypes need to be declared before functions are being
> used.
They do? What problem is this patch fixing, I don't see the error...
confused,
greg k-h
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Outreachy kernel] [PATCH 2/4] Staging: lustre: include: Convert macro class_export_lock_get into static inline function
2015-10-14 21:07 ` [PATCH 2/4] Staging: lustre: include: Convert macro class_export_lock_get into static inline function Ksenija Stanojevic
@ 2015-10-17 5:28 ` Greg KH
2015-10-17 7:10 ` Ksenija Stanojević
0 siblings, 1 reply; 10+ messages in thread
From: Greg KH @ 2015-10-17 5:28 UTC (permalink / raw)
To: Ksenija Stanojevic; +Cc: outreachy-kernel
On Wed, Oct 14, 2015 at 11:07:20PM +0200, Ksenija Stanojevic wrote:
> 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>
> ---
> drivers/staging/lustre/lustre/include/obd_class.h | 17 +++++++++--------
> 1 file changed, 9 insertions(+), 8 deletions(-)
This, and patch 3/4, break the build very badly, did you test these
patches?
greg k-h
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Outreachy kernel] [PATCH 1/4] Staging: lustre: include: Move function prototypes
2015-10-17 5:24 ` [Outreachy kernel] " Greg KH
@ 2015-10-17 7:09 ` Ksenija Stanojević
2015-10-17 7:16 ` Greg KH
0 siblings, 1 reply; 10+ messages in thread
From: Ksenija Stanojević @ 2015-10-17 7:09 UTC (permalink / raw)
To: Greg KH; +Cc: outreachy-kernel
Hi,
On Sat, Oct 17, 2015 at 7:24 AM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Wed, Oct 14, 2015 at 11:06:28PM +0200, Ksenija Stanojevic wrote:
>> Function prototypes need to be declared before functions are being
>> used.
>
> They do? What problem is this patch fixing, I don't see the error...
These functions:
+struct obd_export *class_export_get(struct obd_export *exp);
+void class_export_put(struct obd_export *exp)
are used in macros that I changed into static inline
functions. So if I don't move them, there will be warning: implicit
declaration...
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Outreachy kernel] [PATCH 2/4] Staging: lustre: include: Convert macro class_export_lock_get into static inline function
2015-10-17 5:28 ` [Outreachy kernel] " Greg KH
@ 2015-10-17 7:10 ` Ksenija Stanojević
0 siblings, 0 replies; 10+ messages in thread
From: Ksenija Stanojević @ 2015-10-17 7:10 UTC (permalink / raw)
To: Greg KH; +Cc: outreachy-kernel
On Sat, Oct 17, 2015 at 7:28 AM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Wed, Oct 14, 2015 at 11:07:20PM +0200, Ksenija Stanojevic wrote:
>> 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>
>> ---
>> drivers/staging/lustre/lustre/include/obd_class.h | 17 +++++++++--------
>> 1 file changed, 9 insertions(+), 8 deletions(-)
>
> This, and patch 3/4, break the build very badly, did you test these
> patches?
I'm sorry. Yes I did test them, with doing make on top of the directory.
I will try again...
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Outreachy kernel] [PATCH 1/4] Staging: lustre: include: Move function prototypes
2015-10-17 7:09 ` Ksenija Stanojević
@ 2015-10-17 7:16 ` Greg KH
0 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2015-10-17 7:16 UTC (permalink / raw)
To: Ksenija Stanojević; +Cc: outreachy-kernel
On Sat, Oct 17, 2015 at 09:09:19AM +0200, Ksenija Stanojević wrote:
> Hi,
>
> On Sat, Oct 17, 2015 at 7:24 AM, Greg KH <gregkh@linuxfoundation.org> wrote:
> > On Wed, Oct 14, 2015 at 11:06:28PM +0200, Ksenija Stanojevic wrote:
> >> Function prototypes need to be declared before functions are being
> >> used.
> >
> > They do? What problem is this patch fixing, I don't see the error...
>
> These functions:
>
> +struct obd_export *class_export_get(struct obd_export *exp);
> +void class_export_put(struct obd_export *exp)
>
> are used in macros that I changed into static inline
> functions. So if I don't move them, there will be warning: implicit
> declaration...
Ah, then you needed to say that, please be more specific, I dropped this
patch, and then the later ones failed horribly.
Please fix up and resend the series.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-10-17 7:16 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-14 21:04 [PATCH 0/4]Staging: lustre: Use static inline functions instead of macros Ksenija Stanojevic
2015-10-14 21:06 ` [PATCH 1/4] Staging: lustre: include: Move function prototypes Ksenija Stanojevic
2015-10-17 5:24 ` [Outreachy kernel] " Greg KH
2015-10-17 7:09 ` Ksenija Stanojević
2015-10-17 7:16 ` Greg KH
2015-10-14 21:07 ` [PATCH 2/4] Staging: lustre: include: Convert macro class_export_lock_get into static inline function Ksenija Stanojevic
2015-10-17 5:28 ` [Outreachy kernel] " Greg KH
2015-10-17 7:10 ` Ksenija Stanojević
2015-10-14 21:08 ` [PATCH 3/4] Staging: lustre: include: Convert macro class_export_lock_put " Ksenija Stanojevic
2015-10-14 21:09 ` [PATCH 4/4] Staging: lustre: include : Remove unused macros Ksenija Stanojevic
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.