common-utils: gf_log2 handles 0 input
Signed-off-by: Anand V. Avati <avati@amp.gluster.com> Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 583 (filesystem access hangs while deleting large files) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=583
This commit is contained in:
parent
2a78ca786d
commit
5f524f4b2f
@ -58,11 +58,11 @@ struct dnscache6 {
|
||||
|
||||
|
||||
int
|
||||
gf_log2 (unsigned long x)
|
||||
log_base2 (unsigned long x)
|
||||
{
|
||||
int val = 0;
|
||||
|
||||
while (x != 1) {
|
||||
while (x > 1) {
|
||||
x /= 2;
|
||||
val++;
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ int gf_lockfd (int fd);
|
||||
int gf_unlockfd (int fd);
|
||||
|
||||
int get_checksum_for_file (int fd, uint32_t *checksum);
|
||||
int gf_log2 (unsigned long x);
|
||||
int log_base2 (unsigned long x);
|
||||
|
||||
#endif /* _COMMON_UTILS_H */
|
||||
|
||||
|
@ -1462,7 +1462,7 @@ init (xlator_t *this)
|
||||
ret = 0;
|
||||
|
||||
ctx = this->ctx;
|
||||
ioc_log2_page_size = gf_log2 (ctx->page_size);
|
||||
ioc_log2_page_size = log_base2 (ctx->page_size);
|
||||
|
||||
out:
|
||||
if (ret == -1) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user