Message ID | 20180719084842.11385-2-ying.huang@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Jul 19, 2018 at 04:48:35PM +0800, Huang Ying wrote: > +/* > + * Determine the locking method in use for this device. Return > + * swap_cluster_info if SSD-style cluster-based locking is in place. > + */ > static inline struct swap_cluster_info *lock_cluster_or_swap_info( > struct swap_info_struct *si, > unsigned long offset) > { > struct swap_cluster_info *ci; > > + /* Try to use fine-grained SSD-style locking if available: */ Once you touch this are can you also please use standard two-tab alignment for the spill-over function arguments: static inline struct swap_cluster_info *lock_cluster_or_swap_info( struct swap_info_struct *si, unsigned long offset)
Christoph Hellwig <hch@infradead.org> writes: > On Thu, Jul 19, 2018 at 04:48:35PM +0800, Huang Ying wrote: >> +/* >> + * Determine the locking method in use for this device. Return >> + * swap_cluster_info if SSD-style cluster-based locking is in place. >> + */ >> static inline struct swap_cluster_info *lock_cluster_or_swap_info( >> struct swap_info_struct *si, >> unsigned long offset) >> { >> struct swap_cluster_info *ci; >> >> + /* Try to use fine-grained SSD-style locking if available: */ > > Once you touch this are can you also please use standard two-tab > alignment for the spill-over function arguments: > > static inline struct swap_cluster_info *lock_cluster_or_swap_info( > struct swap_info_struct *si, unsigned long offset) Sure. Will change this in next version. Best Regards, Huang, Ying
diff --git a/mm/swapfile.c b/mm/swapfile.c index d8fddfb000ec..29da44411734 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -297,13 +297,19 @@ static inline void unlock_cluster(struct swap_cluster_info *ci) spin_unlock(&ci->lock); } +/* + * Determine the locking method in use for this device. Return + * swap_cluster_info if SSD-style cluster-based locking is in place. + */ static inline struct swap_cluster_info *lock_cluster_or_swap_info( struct swap_info_struct *si, unsigned long offset) { struct swap_cluster_info *ci; + /* Try to use fine-grained SSD-style locking if available: */ ci = lock_cluster(si, offset); + /* Otherwise, fall back to traditional, coarse locking: */ if (!ci) spin_lock(&si->lock);