Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 46fd3c61 authored by Liu Xuezhao's avatar Liu Xuezhao Committed by Greg Kroah-Hartman
Browse files

staging/lustre/obdclass: add obd_target.h

Move some server-side data structures form obd.h to obd_target.h.  To
remove some code dependencies use HAVE_SERVER_SUPPORT to protect some
llog/fsfilt_* functions.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1330
Lustre-change: http://review.whamcloud.com/2678


Signed-off-by: default avatarLiu Xuezhao <xuezhao.liu@emc.com>
Signed-off-by: default avatarJohn L. Hammond <john.hammond@intel.com>
Reviewed-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Reviewed-by: default avatarPeng Tao <bergwolf@gmail.com>
Reviewed-by: default avatarMike Pershin <mike.pershin@intel.com>
Signed-off-by: default avatarPeng Tao <tao.peng@emc.com>
Signed-off-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0dd6f4a4
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -145,16 +145,6 @@ static inline int fsfilt_commit(struct obd_device *obd, struct inode *inode,
	return rc;
}

static inline int fsfilt_map_inode_pages(struct obd_device *obd,
					 struct inode *inode,
					 struct page **page, int pages,
					 unsigned long *blocks,
					 int create, struct mutex *mutex)
{
	return obd->obd_fsops->fs_map_inode_pages(inode, page, pages, blocks,
						  create, mutex);
}

static inline int fsfilt_read_record(struct obd_device *obd, struct file *file,
				     void *buf, loff_t size, loff_t *offs)
{
+0 −36
Original line number Diff line number Diff line
@@ -370,18 +370,6 @@ static inline void s2dhms(struct dhms *ts, time_t secs)
#define JOBSTATS_DISABLE		"disable"
#define JOBSTATS_PROCNAME_UID		"procname_uid"

typedef void (*cntr_init_callback)(struct lprocfs_stats *stats);

struct obd_job_stats {
	cfs_hash_t	*ojs_hash;
	struct list_head	 ojs_list;
	rwlock_t       ojs_lock; /* protect the obj_list */
	cntr_init_callback ojs_cntr_init_fn;
	int		ojs_cntr_num;
	int		ojs_cleanup_interval;
	time_t		   ojs_last_cleanup;
};

#ifdef LPROCFS

extern int lprocfs_stats_alloc_one(struct lprocfs_stats *stats,
@@ -748,16 +736,6 @@ struct file_operations name##_fops = { \
		.release = lprocfs_single_release,			\
	};

/* lprocfs_jobstats.c */
int lprocfs_job_stats_log(struct obd_device *obd, char *jobid,
			  int event, long amount);
void lprocfs_job_stats_fini(struct obd_device *obd);
int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
			   cntr_init_callback fn);
int lprocfs_rd_job_interval(struct seq_file *m, void *data);
int lprocfs_wr_job_interval(struct file *file, const char *buffer,
			    unsigned long count, void *data);

/* lproc_ptlrpc.c */
struct ptlrpc_request;
extern void target_print_req(void *seq_file, struct ptlrpc_request *req);
@@ -1018,20 +996,6 @@ __u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx,
#define LPROC_SEQ_FOPS_RW_TYPE(name, type)
#define LPROC_SEQ_FOPS_WR_ONLY(name, type)

/* lprocfs_jobstats.c */
static inline
int lprocfs_job_stats_log(struct obd_device *obd, char *jobid, int event,
			  long amount)
{ return 0; }
static inline
void lprocfs_job_stats_fini(struct obd_device *obd)
{ return; }
static inline
int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
			   cntr_init_callback fn)
{ return 0; }


/* lproc_ptlrpc.c */
#define target_print_req NULL

+2 −138
Original line number Diff line number Diff line
@@ -49,6 +49,8 @@
#define IOC_MDC_MAX_NR       50

#include <lustre/lustre_idl.h>
#include <lustre_lib.h>
#include <linux/libcfs/bitmap.h>
#include <lu_ref.h>
#include <lustre_lib.h>
#include <lustre_export.h>
@@ -56,9 +58,6 @@
#include <lustre_fld.h>
#include <lustre_capa.h>

#include <linux/libcfs/bitmap.h>


#define MAX_OBD_DEVICES 8192

struct osc_async_rc {
@@ -254,30 +253,6 @@ struct brw_page {
	obd_flag flag;
};

/* Individual type definitions */

struct ost_server_data;

struct osd_properties {
	size_t osd_max_ea_size;
};

#define OBT_MAGIC       0xBDDECEAE
/* hold common fields for "target" device */
struct obd_device_target {
	__u32		     obt_magic;
	__u32		     obt_instance;
	struct super_block       *obt_sb;
	/** last_rcvd file */
	struct file	      *obt_rcvd_filp;
	__u64		     obt_mount_count;
	struct rw_semaphore	  obt_rwsem;
	struct vfsmount	  *obt_vfsmnt;
	struct file	      *obt_health_check_filp;
	struct osd_properties     obt_osd_properties;
	struct obd_job_stats      obt_jobstats;
};

/* llog contexts */
enum llog_ctxt_id {
	LLOG_CONFIG_ORIG_CTXT  =  0,
@@ -299,94 +274,6 @@ enum llog_ctxt_id {
	LLOG_MAX_CTXTS
};

#define FILTER_SUBDIR_COUNT      32	    /* set to zero for no subdirs */

struct filter_subdirs {
	struct dentry *dentry[FILTER_SUBDIR_COUNT];
};


struct filter_ext {
	__u64		fe_start;
	__u64		fe_end;
};

struct filter_obd {
	/* NB this field MUST be first */
	struct obd_device_target fo_obt;
	const char		*fo_fstype;

	int			fo_group_count;
	struct dentry		*fo_dentry_O;
	struct dentry		**fo_dentry_O_groups;
	struct filter_subdirs	*fo_dentry_O_sub;
	struct mutex		fo_init_lock;	/* group initialization lock*/
	int			fo_committed_group;

	spinlock_t		fo_objidlock;	/* protect fo_lastobjid */

	unsigned long		fo_destroys_in_progress;
	struct mutex		fo_create_locks[FILTER_SUBDIR_COUNT];

	struct list_head fo_export_list;
	int		  fo_subdir_count;

	obd_size	     fo_tot_dirty;      /* protected by obd_osfs_lock */
	obd_size	     fo_tot_granted;    /* all values in bytes */
	obd_size	     fo_tot_pending;
	int		  fo_tot_granted_clients;

	obd_size	     fo_readcache_max_filesize;
	spinlock_t		fo_flags_lock;
	unsigned int	 fo_read_cache:1,   /**< enable read-only cache */
			     fo_writethrough_cache:1,/**< read cache writes */
			     fo_mds_ost_sync:1, /**< MDS-OST orphan recovery*/
			     fo_raid_degraded:1;/**< RAID device degraded */

	struct obd_import   *fo_mdc_imp;
	struct obd_uuid      fo_mdc_uuid;
	struct lustre_handle fo_mdc_conn;
	struct file	**fo_last_objid_files;
	__u64	       *fo_last_objids; /* last created objid for groups,
					      * protected by fo_objidlock */

	struct mutex		fo_alloc_lock;

	atomic_t	 fo_r_in_flight;
	atomic_t	 fo_w_in_flight;

	/*
	 * per-filter pool of kiobuf's allocated by filter_common_setup() and
	 * torn down by filter_cleanup().
	 *
	 * This pool contains kiobuf used by
	 * filter_{prep,commit}rw_{read,write}() and is shared by all OST
	 * threads.
	 *
	 * Locking: protected by internal lock of cfs_hash, pool can be
	 * found from this hash table by t_id of ptlrpc_thread.
	 */
	struct cfs_hash		*fo_iobuf_hash;

	struct brw_stats	 fo_filter_stats;

	int		      fo_fmd_max_num; /* per exp filter_mod_data */
	int		      fo_fmd_max_age; /* jiffies to fmd expiry */
	unsigned long	    fo_syncjournal:1, /* sync journal on writes */
				 fo_sync_lock_cancel:2;/* sync on lock cancel */


	/* sptlrpc stuff */
	rwlock_t		fo_sptlrpc_lock;
	struct sptlrpc_rule_set  fo_sptlrpc_rset;

	/* capability related */
	unsigned int	     fo_fl_oss_capa;
	struct list_head	       fo_capa_keys;
	struct hlist_head	*fo_capa_hash;
	int		      fo_sec_level;
};

struct timeout_item {
	enum timeout_event ti_event;
	cfs_time_t	 ti_timeout;
@@ -552,25 +439,6 @@ struct obd_id_info {
	obd_id  *data;
};

/* */

struct echo_obd {
	struct obd_device_target eo_obt;
	struct obdo		eo_oa;
	spinlock_t		 eo_lock;
	__u64			 eo_lastino;
	struct lustre_handle	eo_nl_lock;
	atomic_t		eo_prep;
};

struct ost_obd {
	struct ptlrpc_service	*ost_service;
	struct ptlrpc_service	*ost_create_service;
	struct ptlrpc_service	*ost_io_service;
	struct ptlrpc_service	*ost_seq_service;
	struct mutex		ost_health_mutex;
};

struct echo_client_obd {
	struct obd_export	*ec_exp;   /* the local connection to osc/lov */
	spinlock_t		ec_lock;
@@ -1052,12 +920,8 @@ struct obd_device {
	int			      obd_recovery_stage;

	union {
		struct obd_device_target obt;
		struct filter_obd filter;
		struct client_obd cli;
		struct ost_obd ost;
		struct echo_client_obd echo_client;
		struct echo_obd echo;
		struct lov_obd lov;
		struct lmv_obd lmv;
	} u;
+0 −1
Original line number Diff line number Diff line
@@ -46,7 +46,6 @@
#include <linux/pagemap.h>
#include <linux/quotaops.h>
#include <linux/libcfs/libcfs.h>
#include <lustre_fsfilt.h>
#include <obd.h>
#include <linux/module.h>
#include <linux/init.h>
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ obj-$(CONFIG_LUSTRE_FS) += obdclass.o llog_test.o
obdclass-y := linux/linux-module.o linux/linux-obdo.o linux/linux-sysctl.o \
	      llog.o llog_cat.o llog_obd.o llog_swab.o class_obd.o debug.o \
	      genops.o uuid.o llog_ioctl.o lprocfs_status.o		   \
	      lprocfs_jobstats.o lustre_handles.o lustre_peer.o llog_osd.o \
	      lustre_handles.o lustre_peer.o llog_osd.o \
	      local_storage.o statfs_pack.o obdo.o obd_config.o obd_mount.o\
	      mea.o lu_object.o dt_object.o capa.o cl_object.o   \
	      cl_page.o cl_lock.o cl_io.o lu_ref.o acl.o idmap.o	   \
Loading