* [Ocfs2-devel] [PATCH] ocfs2: Use cpu_to_le16 for e_leaf_clusters in ocfs2_bg_discontig_add_extent.
@ 2010-09-13 6:09 Tao Ma
2010-09-13 6:29 ` Joel Becker
0 siblings, 1 reply; 4+ messages in thread
From: Tao Ma @ 2010-09-13 6:09 UTC (permalink / raw)
To: ocfs2-devel
e_leaf_clusters is a le16, so use cpu_to_le16 instead
of cpu_to_le32.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
---
fs/ocfs2/suballoc.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index a8e6a95..039f69b 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -348,7 +348,7 @@ static void ocfs2_bg_discontig_add_extent(struct ocfs2_super *osb,
rec->e_blkno = cpu_to_le64(p_blkno);
rec->e_cpos = cpu_to_le32(le16_to_cpu(bg->bg_bits) /
le16_to_cpu(cl->cl_bpc));
- rec->e_leaf_clusters = cpu_to_le32(clusters);
+ rec->e_leaf_clusters = cpu_to_le16(clusters);
le16_add_cpu(&bg->bg_bits, clusters * le16_to_cpu(cl->cl_bpc));
le16_add_cpu(&bg->bg_free_bits_count,
clusters * le16_to_cpu(cl->cl_bpc));
--
1.7.1.GIT
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Ocfs2-devel] [PATCH] ocfs2: Use cpu_to_le16 for e_leaf_clusters in ocfs2_bg_discontig_add_extent.
2010-09-13 6:09 [Ocfs2-devel] [PATCH] ocfs2: Use cpu_to_le16 for e_leaf_clusters in ocfs2_bg_discontig_add_extent Tao Ma
@ 2010-09-13 6:29 ` Joel Becker
2010-09-13 7:13 ` [Ocfs2-devel] [PATCH v2] " Tao Ma
0 siblings, 1 reply; 4+ messages in thread
From: Joel Becker @ 2010-09-13 6:29 UTC (permalink / raw)
To: ocfs2-devel
On Mon, Sep 13, 2010 at 02:09:53PM +0800, Tao Ma wrote:
> e_leaf_clusters is a le16, so use cpu_to_le16 instead
> of cpu_to_le32.
>
> Signed-off-by: Tao Ma <tao.ma@oracle.com>
You're right that we need to swap as an le16.
> @@ -348,7 +348,7 @@ static void ocfs2_bg_discontig_add_extent(struct ocfs2_super *osb,
> rec->e_blkno = cpu_to_le64(p_blkno);
> rec->e_cpos = cpu_to_le32(le16_to_cpu(bg->bg_bits) /
> le16_to_cpu(cl->cl_bpc));
> - rec->e_leaf_clusters = cpu_to_le32(clusters);
> + rec->e_leaf_clusters = cpu_to_le16(clusters);
For a second I was worried, "what about overflow if clusters >
16bits?" Of course, this is coming from discontig stuff which starts at
cpg, so it can't overflow. Maybe discontig_add_extent should take
"unsigned int clusters" instead of "u32 clusters" to signify that the
size of 'clusters isn't important here?
Joel
--
"Friends may come and go, but enemies accumulate."
- Thomas Jones
Joel Becker
Consulting Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Ocfs2-devel] [PATCH v2] ocfs2: Use cpu_to_le16 for e_leaf_clusters in ocfs2_bg_discontig_add_extent.
2010-09-13 6:29 ` Joel Becker
@ 2010-09-13 7:13 ` Tao Ma
2010-09-23 21:23 ` Joel Becker
0 siblings, 1 reply; 4+ messages in thread
From: Tao Ma @ 2010-09-13 7:13 UTC (permalink / raw)
To: ocfs2-devel
e_leaf_clusters is a le16, so use cpu_to_le16 instead
of cpu_to_le32.
What's more, we change 'clusters' to unsigned int to
signify that the size of 'clusters' isn't important here.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
---
fs/ocfs2/suballoc.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index a8e6a95..6bad4d0 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -336,7 +336,7 @@ out:
static void ocfs2_bg_discontig_add_extent(struct ocfs2_super *osb,
struct ocfs2_group_desc *bg,
struct ocfs2_chain_list *cl,
- u64 p_blkno, u32 clusters)
+ u64 p_blkno, unsigned int clusters)
{
struct ocfs2_extent_list *el = &bg->bg_list;
struct ocfs2_extent_rec *rec;
@@ -348,7 +348,7 @@ static void ocfs2_bg_discontig_add_extent(struct ocfs2_super *osb,
rec->e_blkno = cpu_to_le64(p_blkno);
rec->e_cpos = cpu_to_le32(le16_to_cpu(bg->bg_bits) /
le16_to_cpu(cl->cl_bpc));
- rec->e_leaf_clusters = cpu_to_le32(clusters);
+ rec->e_leaf_clusters = cpu_to_le16(clusters);
le16_add_cpu(&bg->bg_bits, clusters * le16_to_cpu(cl->cl_bpc));
le16_add_cpu(&bg->bg_free_bits_count,
clusters * le16_to_cpu(cl->cl_bpc));
--
1.7.1.GIT
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Ocfs2-devel] [PATCH v2] ocfs2: Use cpu_to_le16 for e_leaf_clusters in ocfs2_bg_discontig_add_extent.
2010-09-13 7:13 ` [Ocfs2-devel] [PATCH v2] " Tao Ma
@ 2010-09-23 21:23 ` Joel Becker
0 siblings, 0 replies; 4+ messages in thread
From: Joel Becker @ 2010-09-23 21:23 UTC (permalink / raw)
To: ocfs2-devel
On Mon, Sep 13, 2010 at 03:13:50PM +0800, Tao Ma wrote:
> e_leaf_clusters is a le16, so use cpu_to_le16 instead
> of cpu_to_le32.
>
> What's more, we change 'clusters' to unsigned int to
> signify that the size of 'clusters' isn't important here.
>
> Signed-off-by: Tao Ma <tao.ma@oracle.com>
This patch is now in the 'fixes' branch of ocfs2.git.
Joel
--
"The question of whether computers can think is just like the question
of whether submarines can swim."
- Edsger W. Dijkstra
Joel Becker
Consulting Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-09-23 21:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-13 6:09 [Ocfs2-devel] [PATCH] ocfs2: Use cpu_to_le16 for e_leaf_clusters in ocfs2_bg_discontig_add_extent Tao Ma
2010-09-13 6:29 ` Joel Becker
2010-09-13 7:13 ` [Ocfs2-devel] [PATCH v2] " Tao Ma
2010-09-23 21:23 ` Joel Becker
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.