[Ocfs2-devel] [PATCH 06/14] ocfs2: Set the xattr name+value pair in one place

Joel Becker Joel.Becker at oracle.com
Wed Sep 2 03:30:37 PDT 2009


On Wed, Sep 02, 2009 at 05:34:16PM +0800, Tiger Yang wrote:
> Joel Becker wrote:
> >+
> >+static void ocfs2_xa_add_namevalue(struct ocfs2_xa_loc *loc,
> >+				   struct ocfs2_xattr_info *xi)
> >+{
> >+	int size = namevalue_size_xi(xi);
> >+	int nameval_offset;
> >+	char *nameval_buf;
> >+
> >+	loc->xl_ops->xlo_add_namevalue(loc, size);
> >+	loc->xl_entry->xe_value_size = cpu_to_le64(xi->xi_value_len);
> >+	ocfs2_xattr_set_type(loc->xl_entry, xi->xi_name_index);
> >+	ocfs2_xattr_set_local(loc->xl_entry,
> >+			      xi->xi_value_len <= OCFS2_XATTR_INLINE_SIZE);
> >+
> >+	nameval_offset = le16_to_cpu(loc->xl_entry->xe_name_offset);
> >+	nameval_buf = ocfs2_xa_offset_pointer(loc, nameval_offset);
> >+	memset(nameval_buf, 0, size);
> >+	memcpy(nameval_buf, xi->xi_name, xi->xi_name_len);
> >+}
> In add namevalue, we should update xl_entry->xe_name_len as well. In
> here we only have a blank entry, so we need to fill this one.
> Maybe we should update xe_name_len somewhere else.

	Good catch.  It belongs right here.  Fixed version pushed.

Joel

-- 

"Can any of you seriously say the Bill of Rights could get through
 Congress today?  It wouldn't even get out of committee."
	- F. Lee Bailey

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127



More information about the Ocfs2-devel mailing list