From c35df11f84de07e026228eb6a875839a685b5a4f Mon Sep 17 00:00:00 2001 From: pschwan Date: Wed, 11 Sep 2002 18:22:57 +0000 Subject: [PATCH] b=600245 Fixes this bug by remember that sizeof() returns the size in bytes, not bits. --- lustre/mds/mds_fs.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lustre/mds/mds_fs.c b/lustre/mds/mds_fs.c index b6a0a50..6e11964 100644 --- a/lustre/mds/mds_fs.c +++ b/lustre/mds/mds_fs.c @@ -46,7 +46,7 @@ int mds_client_add(struct mds_export_data *med, int cl_off) { if (cl_off == -1) { unsigned long *word; - int bit; + int bit, bits_per_word = sizeof(*word) * 8; repeat: word = last_rcvd_slots; @@ -63,7 +63,7 @@ int mds_client_add(struct mds_export_data *med, int cl_off) LBUG(); goto repeat; } - cl_off = (word - last_rcvd_slots) * sizeof(*word) + bit; + cl_off = (word - last_rcvd_slots) * bits_per_word + bit; } else { /* test_and_set_bit can handle cl_off > sizeof(long), so there's * no need to frob it */ @@ -85,7 +85,7 @@ int mds_client_free(struct obd_export *exp) { struct mds_export_data *med = &exp->exp_mds_data; unsigned long *word; - int bit; + int bit, bits_per_word = sizeof(*word) * 8; if (!med->med_mcd) RETURN(0); @@ -93,8 +93,8 @@ int mds_client_free(struct obd_export *exp) CDEBUG(D_INFO, "freeing client at offset %d with UUID '%s'\n", med->med_off, med->med_mcd->mcd_uuid); - word = last_rcvd_slots + med->med_off / sizeof(unsigned long); - bit = med->med_off % sizeof(unsigned long); + word = last_rcvd_slots + med->med_off / bits_per_word; + bit = med->med_off % bits_per_word; if (!test_and_clear_bit(bit, word)) { CERROR("bit %d already clear in word %d - bad bad\n", -- 1.8.3.1