[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEH94LidECTUHb0_Wujyg=zH18+dzxMPTUUpiYBeUSiG7MpSKQ@mail.gmail.com>
Date: Sun, 28 Oct 2012 21:51:48 +0800
From: Zhi Yong Wu <zwu.kernel@...il.com>
To: zwu.kernel@...il.com, linux-fsdevel@...r.kernel.org,
linux-ext4@...r.kernel.org, linux-btrfs@...r.kernel.org,
linux-kernel@...r.kernel.org, linuxram@...ux.vnet.ibm.com,
viro@...iv.linux.org.uk, david@...morbit.com, tytso@....edu,
cmm@...ibm.com, Zhi Yong Wu <wuzhy@...ux.vnet.ibm.com>
Subject: Re: [RFC v4 03/15] vfs,hot_track: add the function for collecting I/O frequency
On Sun, Oct 28, 2012 at 3:55 PM, Zheng Liu <gnehzuil.liu@...il.com> wrote:
> Hi Zhiyong,
>
> On Thu, Oct 25, 2012 at 11:08:55PM +0800, zwu.kernel@...il.com wrote:
> [snip]
>> @@ -199,6 +342,54 @@ err:
>> }
>>
>> /*
>> + * Main function to update access frequency from read/writepage(s) hooks
>> + */
>> +inline void hot_update_freqs(struct inode *inode, u64 start,
>> + u64 len, int rw)
>
> This function seems too big. So we really need to inline this function?
As Dave said in his comments, it will add a function call
overhead even when tracking is not enabled. a static inline function
will just result in no extra overhead other than the if
statement....
>
> Regards,
> Zheng
>
>> +{
>> + struct hot_info *root = inode->i_sb->s_hot_root;
>> + struct hot_inode_item *he;
>> + struct hot_range_item *hr;
>> + u32 cur, end;
>> +
>> + if (!root || (len == 0))
>> + return;
>> +
>> + he = hot_inode_item_find(root, inode->i_ino);
>> + if (IS_ERR(he)) {
>> + WARN_ON(1);
>> + return;
>> + }
>> +
>> + spin_lock(&he->hot_inode.lock);
>> + hot_freq_data_update(&he->hot_inode.hot_freq_data, rw);
>> + spin_unlock(&he->hot_inode.lock);
>> +
>> + /*
>> + * Align ranges on RANGE_SIZE boundary
>> + * to prevent proliferation of range structs
>> + */
>> + end = (start + len + RANGE_SIZE - 1) >> RANGE_BITS;
>> + for (cur = (start >> RANGE_BITS); cur < end; cur++) {
>> + hr = hot_range_item_find(he, cur);
>> + if (IS_ERR(hr)) {
>> + WARN_ON(1);
>> + hot_inode_item_put(he);
>> + return;
>> + }
>> +
>> + spin_lock(&hr->hot_range.lock);
>> + hot_freq_data_update(&hr->hot_range.hot_freq_data, rw);
>> + spin_unlock(&hr->hot_range.lock);
>> +
>> + hot_range_item_put(hr);
>> + }
>> +
>> + hot_inode_item_put(he);
>> +}
>> +EXPORT_SYMBOL_GPL(hot_update_freqs);
--
Regards,
Zhi Yong Wu
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists