Re: [PATCH v2 01/12] md/raid5: Factor out ahead_of_reshape() function

From: Guoqing Jiang
Date: Wed Apr 27 2022 - 21:50:11 EST




On 4/28/22 12:07 AM, Logan Gunthorpe wrote:

On 2022-04-26 19:28, Guoqing Jiang wrote:
  +static bool ahead_of_reshape(struct mddev *mddev, sector_t sector,
+                 sector_t reshape_sector)
+{
+    if (mddev->reshape_backwards)
+        return sector < reshape_sector;
+    else
+        return sector >= reshape_sector;
+}
I think it can be an inline function.
Marking static functions in C files as inline is not recommended. GCC
will inline it, if it is appropriate.

https://yarchive.net/comp/linux/inline.html
https://www.kernel.org/doc/local/inline.html

Thanks for the link, then I suppose those can be deleted

linux> grep "static inline" drivers/md/md.h -r
static inline int is_badblock(struct md_rdev *rdev, sector_t s, int sectors,
static inline int __must_check mddev_lock(struct mddev *mddev)
static inline void mddev_lock_nointr(struct mddev *mddev)
static inline int mddev_trylock(struct mddev *mddev)
static inline int mddev_is_locked(struct mddev *mddev)
static inline void md_sync_acct(struct block_device *bdev, unsigned long nr_sectors)
static inline void md_sync_acct_bio(struct bio *bio, unsigned long nr_sectors)
static inline struct kernfs_node *sysfs_get_dirent_safe(struct kernfs_node *sd, char *name)
static inline void sysfs_notify_dirent_safe(struct kernfs_node *sd)
static inline char * mdname (struct mddev * mddev)
static inline int sysfs_link_rdev(struct mddev *mddev, struct md_rdev *rdev)
static inline void sysfs_unlink_rdev(struct mddev *mddev, struct md_rdev *rdev)
static inline void safe_put_page(struct page *p)
static inline bool is_mddev_broken(struct md_rdev *rdev, const char *md_type)
static inline void rdev_dec_pending(struct md_rdev *rdev, struct mddev *mddev)
static inline int mddev_is_clustered(struct mddev *mddev)
static inline void mddev_clear_unsupported_flags(struct mddev *mddev,
static inline void mddev_check_write_zeroes(struct mddev *mddev, struct bio *bio)

Thanks,
Guoqing