Commit bb21ed15 authored by Oleg Drokin's avatar Oleg Drokin Committed by Greg Kroah-Hartman
Browse files

staging/lustre/obdclass: remove unused file md_attrs.c



It's only used by server side luster for on-disk structure swabbing.

And also remove forward declarations for its functions from
md_object.h and lustre_idl.h

Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 74d3ba98
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -321,9 +321,6 @@ enum lma_incompat {
};
#define LMA_INCOMPAT_SUPP	(LMAI_AGENT | LMAI_REMOTE_PARENT)

extern void lustre_lma_swab(struct lustre_mdt_attrs *lma);
extern void lustre_lma_init(struct lustre_mdt_attrs *lma,
			    const struct lu_fid *fid, __u32 incompat);
/**
 * SOM on-disk attributes stored in a separate xattr.
 */
@@ -344,8 +341,6 @@ struct som_attrs {
	/** mds mount id the size is valid for */
	__u64	som_mountid;
};
extern void lustre_som_swab(struct som_attrs *attrs);

#define SOM_INCOMPAT_SUPP 0x0

/**
@@ -362,7 +357,6 @@ struct hsm_attrs {
	/** version associated with the last archiving, if any */
	__u64	hsm_arch_ver;
};
extern void lustre_hsm_swab(struct hsm_attrs *attrs);

/**
 * fid constants
+0 −4
Original line number Diff line number Diff line
@@ -854,10 +854,6 @@ struct lu_local_obj_desc {
	struct list_head		       llod_linkage;
};

int lustre_buf2som(void *buf, int rc, struct md_som_data *msd);
int lustre_buf2hsm(void *buf, int rc, struct md_hsm *mh);
void lustre_hsm2buf(void *buf, struct md_hsm *mh);

struct lu_ucred {
	__u32	       uc_valid;
	__u32	       uc_o_uid;
+0 −199
Original line number Diff line number Diff line
/*
 * GPL HEADER START
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 only,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License version 2 for more details (a copy is included
 * in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU General Public License
 * version 2 along with this program; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 021110-1307, USA
 *
 * GPL HEADER END
 */
/*
 * Copyright (c) 2012, Intel Corporation.
 * Use is subject to license terms.
 *
 * Author: Johann Lombardi <johann.lombardi@intel.com>
 */

#include "../include/lustre/lustre_idl.h"
#include "../include/obd.h"
#include "../include/md_object.h"

/**
 * Initialize new \a lma. Only fid is stored.
 *
 * \param lma - is the new LMA structure to be initialized
 * \param fid - is the FID of the object this LMA belongs to
 * \param incompat - features that MDS must understand to access object
 */
void lustre_lma_init(struct lustre_mdt_attrs *lma, const struct lu_fid *fid,
		     __u32 incompat)
{
	lma->lma_compat   = 0;
	lma->lma_incompat = incompat;
	lma->lma_self_fid = *fid;

	/* If a field is added in struct lustre_mdt_attrs, zero it explicitly
	 * and change the test below. */
	LASSERT(sizeof(*lma) ==
		(offsetof(struct lustre_mdt_attrs, lma_self_fid) +
		 sizeof(lma->lma_self_fid)));
};
EXPORT_SYMBOL(lustre_lma_init);

/**
 * Swab, if needed, LMA structure which is stored on-disk in little-endian order.
 *
 * \param lma - is a pointer to the LMA structure to be swabbed.
 */
void lustre_lma_swab(struct lustre_mdt_attrs *lma)
{
	/* Use LUSTRE_MSG_MAGIC to detect local endianness. */
	if (LUSTRE_MSG_MAGIC != cpu_to_le32(LUSTRE_MSG_MAGIC)) {
		__swab32s(&lma->lma_compat);
		__swab32s(&lma->lma_incompat);
		lustre_swab_lu_fid(&lma->lma_self_fid);
	}
};
EXPORT_SYMBOL(lustre_lma_swab);

/**
 * Swab, if needed, SOM structure which is stored on-disk in little-endian
 * order.
 *
 * \param attrs - is a pointer to the SOM structure to be swabbed.
 */
void lustre_som_swab(struct som_attrs *attrs)
{
	/* Use LUSTRE_MSG_MAGIC to detect local endianness. */
	if (LUSTRE_MSG_MAGIC != cpu_to_le32(LUSTRE_MSG_MAGIC)) {
		__swab32s(&attrs->som_compat);
		__swab32s(&attrs->som_incompat);
		__swab64s(&attrs->som_ioepoch);
		__swab64s(&attrs->som_size);
		__swab64s(&attrs->som_blocks);
		__swab64s(&attrs->som_mountid);
	}
};
EXPORT_SYMBOL(lustre_som_swab);

/*
 * Swab and extract SOM attributes from on-disk xattr.
 *
 * \param buf - is a buffer containing the on-disk SOM extended attribute.
 * \param rc  - is the SOM xattr stored in \a buf
 * \param msd - is the md_som_data structure where to extract SOM attributes.
 */
int lustre_buf2som(void *buf, int rc, struct md_som_data *msd)
{
	struct som_attrs *attrs = (struct som_attrs *)buf;

	if (rc == 0 ||  rc == -ENODATA)
		/* no SOM attributes */
		return -ENODATA;

	if (rc < 0)
		/* error hit while fetching xattr */
		return rc;

	/* check SOM compatibility */
	if (attrs->som_incompat & ~cpu_to_le32(SOM_INCOMPAT_SUPP))
		return -ENODATA;

	/* unpack SOM attributes */
	lustre_som_swab(attrs);

	/* fill in-memory msd structure */
	msd->msd_compat   = attrs->som_compat;
	msd->msd_incompat = attrs->som_incompat;
	msd->msd_ioepoch  = attrs->som_ioepoch;
	msd->msd_size     = attrs->som_size;
	msd->msd_blocks   = attrs->som_blocks;
	msd->msd_mountid  = attrs->som_mountid;

	return 0;
}
EXPORT_SYMBOL(lustre_buf2som);

/**
 * Swab, if needed, HSM structure which is stored on-disk in little-endian
 * order.
 *
 * \param attrs - is a pointer to the HSM structure to be swabbed.
 */
void lustre_hsm_swab(struct hsm_attrs *attrs)
{
	/* Use LUSTRE_MSG_MAGIC to detect local endianness. */
	if (LUSTRE_MSG_MAGIC != cpu_to_le32(LUSTRE_MSG_MAGIC)) {
		__swab32s(&attrs->hsm_compat);
		__swab32s(&attrs->hsm_flags);
		__swab64s(&attrs->hsm_arch_id);
		__swab64s(&attrs->hsm_arch_ver);
	}
};
EXPORT_SYMBOL(lustre_hsm_swab);

/*
 * Swab and extract HSM attributes from on-disk xattr.
 *
 * \param buf - is a buffer containing the on-disk HSM extended attribute.
 * \param rc  - is the HSM xattr stored in \a buf
 * \param mh  - is the md_hsm structure where to extract HSM attributes.
 */
int lustre_buf2hsm(void *buf, int rc, struct md_hsm *mh)
{
	struct hsm_attrs *attrs = (struct hsm_attrs *)buf;

	if (rc == 0 ||  rc == -ENODATA)
		/* no HSM attributes */
		return -ENODATA;

	if (rc < 0)
		/* error hit while fetching xattr */
		return rc;

	/* unpack HSM attributes */
	lustre_hsm_swab(attrs);

	/* fill md_hsm structure */
	mh->mh_compat   = attrs->hsm_compat;
	mh->mh_flags    = attrs->hsm_flags;
	mh->mh_arch_id  = attrs->hsm_arch_id;
	mh->mh_arch_ver = attrs->hsm_arch_ver;

	return 0;
}
EXPORT_SYMBOL(lustre_buf2hsm);

/*
 * Pack HSM attributes.
 *
 * \param buf - is the output buffer where to pack the on-disk HSM xattr.
 * \param mh  - is the md_hsm structure to pack.
 */
void lustre_hsm2buf(void *buf, struct md_hsm *mh)
{
	struct hsm_attrs *attrs = (struct hsm_attrs *)buf;

	/* copy HSM attributes */
	attrs->hsm_compat   = mh->mh_compat;
	attrs->hsm_flags    = mh->mh_flags;
	attrs->hsm_arch_id  = mh->mh_arch_id;
	attrs->hsm_arch_ver = mh->mh_arch_ver;

	/* pack xattr */
	lustre_hsm_swab(attrs);
}
EXPORT_SYMBOL(lustre_hsm2buf);