lkml.org 
[lkml]   [2013]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH RESEND v1 03/16] vfs: add I/O frequency update function
From
On Fri, Jan 11, 2013 at 10:27 PM, David Sterba <dsterba@suse.cz> wrote:
> On Fri, Jan 11, 2013 at 03:38:31PM +0800, Zhi Yong Wu wrote:
>> On Thu, Jan 10, 2013 at 8:51 AM, David Sterba <dsterba@suse.cz> wrote:
>> > On Thu, Dec 20, 2012 at 10:43:22PM +0800, zwu.kernel@gmail.com wrote:
>> >> --- a/fs/hot_tracking.c
>> >> +++ b/fs/hot_tracking.c
>> >> @@ -164,6 +164,135 @@ static void hot_inode_tree_exit(struct hot_info *root)
>> >> spin_unlock(&root->lock);
>> >> }
>> >>
>> >> +struct hot_inode_item
>> >> +*hot_inode_item_lookup(struct hot_info *root, u64 ino)
>> >> +{
>> >> + struct rb_node **p = &root->hot_inode_tree.map.rb_node;
>> >> + struct rb_node *parent = NULL;
>> >> + struct hot_comm_item *ci;
>> >> + struct hot_inode_item *entry;
>> >> +
>> >> + /* walk tree to find insertion point */
>> >> + spin_lock(&root->lock);
>> >> + while (*p) {
>> >> + parent = *p;
>> >> + ci = rb_entry(parent, struct hot_comm_item, rb_node);
>> >> + entry = container_of(ci, struct hot_inode_item, hot_inode);
>> >> + if (ino < entry->i_ino)
>> >> + p = &(*p)->rb_left;
>> >> + else if (ino > entry->i_ino)
>> >> + p = &(*p)->rb_right;
>> >
>> > style comment: put { } around the all if/else blocks,
>> no, it will violate checkpatch.pl. If the if/else block only contains
>> one line of code, we should not put {} around them.
>
> Unless its in a if / else if / else sequence, see
> Documentation/CodingStyle chapter 3.1. This is what I've learned long
> time ago and using it intuitively. I don't know to what extent
> checkpatch sticks to that document, the code is menat to be read by
> people, so if there is one style prevailing in the subsystem (and it is
> by looking into random fs/*.c files) it's wise to keep the style
> consistent.
I checked *.c in fs/, its coding style about if/else if is consistent
with what i said.:)
e.g in direct-io.c

if (sdio->final_block_in_bio != sdio->cur_page_block ||
cur_offset != bio_next_offset)
dio_bio_submit(dio, sdio);
/*
* Submit now if the underlying fs is about to perform a
* metadata read
*/
else if (sdio->boundary)
dio_bio_submit(dio, sdio);

>
> david



--
Regards,

Zhi Yong Wu


\
 
 \ /
  Last update: 2013-01-11 16:42    [W:0.316 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site