From: Alex Elder <elder@dreamhost.com>
To: Sage Weil <sage@newdream.net>
Cc: ceph-devel@vger.kernel.org
Subject: Re: [PATCH 5/5] ceph: fix up the types of the file layout helpers
Date: Fri, 30 Mar 2012 14:55:59 -0500 [thread overview]
Message-ID: <4F760FCF.2090604@dreamhost.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1203152307310.13626@cobra.newdream.net>
On 03/16/2012 01:10 AM, Sage Weil wrote:
> On Mon, 12 Mar 2012, Alex Elder wrote:
>
>> The helper macros for accessing file layout fields of an on-disk
>> ceph file layout structure cast their results to type (__s32). This
>> is a bit strange, since (with one exception--fl_pg_preferred):
>> - there is no need for negative values; and
>> - all users of these macros are assigning their result to
>> 64-bit variables.
>> So just make these macros return a 64-bit unsigned type.
>>
>> The exception is the preferred placement group, which remains a
>> signed 32-bit value. A placement group id encodes the preferred
>> primary OSD in a 16-bit value, and there's no sense at this point
>> getting too far away from that.
>>
>> Signed-off-by: Alex Elder<elder@dreamhost.com>
. . .
>> diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c
>> index 26c30e7..bc2d807 100644
>> --- a/net/ceph/osdmap.c
>> +++ b/net/ceph/osdmap.c
. . .
>> @@ -1028,29 +1028,30 @@ int ceph_calc_object_layout(struct ceph_object_layout
. . .
>> - ps = ceph_str_hash(pool->v.object_hash, oid, strlen(oid));
>>
>> - if (preferred == CEPH_FILE_LAYOUT_PG_PREFERRED_NONE) {
>> - num = le32_to_cpu(pool->v.pg_num);
>> - num_mask = pool->pg_num_mask;
>> - } else {
>> + ps = ceph_str_hash(pool->v.object_hash, oid, strlen(oid));
>> + if (preferred != CEPH_FILE_LAYOUT_PG_PREFERRED_NONE) {
>> + BUG_ON(preferred< 0);
>> ps += preferred;
>> - num = le32_to_cpu(pool->v.lpg_num);
>> - num_mask = pool->lpg_num_mask;
>> }
>>
>> + num = le32_to_cpu(pool->v.lpg_num);
>> + num_mask = pool->lpg_num_mask;
>
> Unless i'm misreading this diff, you're switching to always using lpg_num
> and lpg_num_mask instead of pg_num and pg_num_mask. That "l" prefix means
> "localized," for a different set of localized PGs used when htere is a
> preferred OSD. We need to keep these assignments in the if and else
> blocks...
No, you read it right and I got it wrong. I misread the code
and thought they were operating with the same fields. I'll fix
it.
-Alex
>> +
>> pgid.ps = cpu_to_le16(ps);
>> - pgid.preferred = cpu_to_le16(preferred);
>> + pgid.preferred = cpu_to_le16((s16) preferred);
>> pgid.pool = fl->fl_pg_pool;
>> if (preferred == CEPH_FILE_LAYOUT_PG_PREFERRED_NONE)
>> dout("calc_object_layout '%s' pgid %d.%x\n", oid, poolid, ps);
. . .
prev parent reply other threads:[~2012-03-30 19:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-12 22:50 [PATCH 0/5] ceph: ceph file layout helper fixes Alex Elder
2012-03-12 22:57 ` [PATCH 1/5] ceph: move file layout helpers to ceph_fs.h Alex Elder
2012-03-12 22:57 ` [PATCH 2/5] ceph: make ceph file layout helpers take a pointer Alex Elder
2012-03-12 22:57 ` [PATCH 3/5] ceph: make use of ceph file layout helpers Alex Elder
2012-03-16 5:59 ` Sage Weil
2012-03-30 19:55 ` Alex Elder
2012-03-12 22:57 ` [PATCH 4/5] ceph: use 64-bit math in ceph_calc_file_object_mapping() Alex Elder
2012-03-16 6:17 ` Sage Weil
2012-03-16 13:25 ` Alex Elder
2012-03-12 22:57 ` [PATCH 5/5] ceph: fix up the types of the file layout helpers Alex Elder
2012-03-16 6:10 ` Sage Weil
2012-03-30 19:55 ` Alex Elder [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F760FCF.2090604@dreamhost.com \
--to=elder@dreamhost.com \
--cc=ceph-devel@vger.kernel.org \
--cc=sage@newdream.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.