Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make functions static/remove redundant checks [afr] #3348

Merged
merged 2 commits into from
Mar 31, 2022

Conversation

harshita-shree
Copy link
Contributor

Made relevant functions static in afr component to improve code readability and performance.
Also removed redundant null checks

Reference to issue #2967
Change-Id: I96172331f1aa0ff2d65ea2a876303ec799bf5144

Signed-off-by: Harshita Shree hshree@redhat.com

@harshita-shree
Copy link
Contributor Author

@karthik-us

@@ -729,7 +729,7 @@ afr_copy_frame(call_frame_t *base)
}

/* Check if an entry or inode could be undergoing a transaction. */
gf_boolean_t
static gf_boolean_t
afr_is_possibly_under_txn(afr_transaction_type type, afr_local_t *local,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this one is a good example - you do not need really to pass 'this' , as you need 'priv'. To be more accurate, you need 'priv->child_count' - which is already available in the 2 callers of this function. We could pass it instead of 'this'. It could be in a follow-up patch of course (and perhaps the compiler already does that?)

@@ -1118,7 +1118,7 @@ __afr_inode_read_subvol_get(inode_t *inode, xlator_t *this, unsigned char *data,
return ret;
}

int
static int
__afr_inode_split_brain_choice_get(inode_t *inode, xlator_t *this,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this one is called only once, from afr_inode_split_brain_choice_get() which by itself is static - can probably be folded into it? (I've done it here for example - https://github.com/gluster/glusterfs/pull/3327/files )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mykaul do you suggest incoporating your changes of altering the return type of __afr_inode_ctx_get() to resolve the above or simply clubbing the two funcs to resolve the above in this patch?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latter, if anything (or we can keep it for later).

@@ -1572,7 +1572,7 @@ afr_set_split_brain_choice(int ret, call_frame_t *frame, void *opaque)
return 0;
}

int
static int
afr_accused_fill(xlator_t *this, dict_t *xdata, unsigned char *accused,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: same as previously, instead of 'this' - you can pass 'priv'. Worth doing in a different patch though.

Change-Id: I96172331f1aa0ff2d65ea2a876303ec799bf5144
Change-Id: Ic3e0a9c8b2db515ca4b5eedfda36b54c4ac9f77b
@harshita-shree
Copy link
Contributor Author

Will be sending a new patch for the above changes

@karthik-us
Copy link
Contributor

/run regression

@karthik-us karthik-us self-requested a review March 29, 2022 10:57
@pbhatia22
Copy link
Contributor

LGTM

@harshita-shree
Copy link
Contributor Author

@xhernandez @mykaul

@xhernandez xhernandez merged commit a38f3d5 into gluster:devel Mar 31, 2022
mykaul pushed a commit to mykaul/glusterfs that referenced this pull request Mar 31, 2022
Made relevant functions static in afr component to improve code readability and performance.
Also removed redundant null checks

Reference to issue gluster#2967
Change-Id: I96172331f1aa0ff2d65ea2a876303ec799bf5144
Signed-off-by: Harshita Shree <hshree@redhat.com>
xhernandez pushed a commit that referenced this pull request Apr 4, 2022
Made relevant functions static in afr component to improve code readability and performance.
Also removed redundant null checks

Reference to issue #2967
Change-Id: I96172331f1aa0ff2d65ea2a876303ec799bf5144
Signed-off-by: Harshita Shree <hshree@redhat.com>
Co-authored-by: Harshita Shree <97235968+harshita-shree@users.noreply.github.com>
xhernandez pushed a commit that referenced this pull request May 3, 2022
Follow up patch for #3348 which simplifies afr function calls .
For instance using replacing xlator_t * with afr_private_t * where needed.

Change-Id: Iaa7b692ed479c8a2bdf7943a6ca1932457a83c99
Signed-off-by : Harshita Shree <hshree@redhat.com>
xhernandez pushed a commit that referenced this pull request May 25, 2022
Making relevant functions static and removed redundant checks on arguments in the DHT component.
Sequence to the patch #3348

Updates #2967
Change-Id: I8e71d82a5a988d815ce7cb6f4021ffde34f6256c
Signed-off-by: Harshita Shree <hshree@redhat.com>
vatsa287 pushed a commit to vatsa287/glusterfs that referenced this pull request Jun 2, 2022
Making relevant functions static and removed redundant checks on arguments in the DHT component.
Sequence to the patch gluster#3348

Updates gluster#2967
Change-Id: I8e71d82a5a988d815ce7cb6f4021ffde34f6256c
Signed-off-by: Harshita Shree <hshree@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants