public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Boaz Harrosh <bharrosh@panasas.com>
Cc: avishay@gmail.com, jeff@garzik.org, viro@ZenIV.linux.org.uk,
	linux-fsdevel@vger.kernel.org, osd-dev@open-osd.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/9] exofs: osd Swiss army knife
Date: Mon, 29 Dec 2008 12:29:59 -0800	[thread overview]
Message-ID: <20081229122959.2cb48cf7.akpm@linux-foundation.org> (raw)
In-Reply-To: <1229439174-30492-1-git-send-email-bharrosh@panasas.com>

On Tue, 16 Dec 2008 16:52:54 +0200
Boaz Harrosh <bharrosh@panasas.com> wrote:

> In this patch are all the osd infrastructure that will be used later
> by the file system.
> 
> Also the declarations of constants, on disk structures, and prototypes.
> 
> And the Kbuild+Kconfig files needed to build the exofs module.
> 
>
> ...
>
> +struct exofs_sb_info {
> +	struct osd_dev	*s_dev;			/* returned by get_osd_dev    */
> +	uint64_t	s_pid;			/* partition ID of file system*/
> +	int		s_timeout;		/* timeout for OSD operations */
> +	uint32_t	s_nextid;		/* highest object ID used     */
> +	uint32_t	s_numfiles;		/* number of files on fs      */
> +	spinlock_t	s_next_gen_lock;	/* spinlock for gen # update  */
> +	u32		s_next_generation;	/* next gen # to use          */
> +	atomic_t	s_curr_pending;		/* number of pending commands */
> +	uint8_t		s_cred[OSD_CAP_LEN];	/* all-powerful credential    */
> +};
> +
> +/*
> + * our inode flags
> + */
> +#ifdef ARCH_HAS_ATOMIC_UNSIGNED

This doesn't exist, and it would be fairly bad to introduce it.  Please
kill the ifdefs.

> +typedef unsigned exofs_iflags_t;
> +#else
> +typedef unsigned long exofs_iflags_t;
> +#endif

Then please kill the typedef altogether and replace it with `unsigned
long' everywhere.

> +#define OBJ_2BCREATED	0	/* object will be created soon*/
> +#define OBJ_CREATED	1	/* object has been created on the osd*/
> +
> +#define Obj2BCreated(oi) \
> +	test_bit(OBJ_2BCREATED, &(oi->i_flags))
> +#define SetObj2BCreated(oi) \
> +	set_bit(OBJ_2BCREATED, &(oi->i_flags))
> +
> +#define ObjCreated(oi) \
> +	test_bit(OBJ_CREATED, &(oi->i_flags))
> +#define SetObjCreated(oi) \
> +	set_bit(OBJ_CREATED, &(oi->i_flags))

- please only implement code in macros when it CANNOT be implemented
  in C.  There are numerous reasons.  One of which is that the above
  macros will happily compile when passed a pointer to ANY truct whcih
  has an i_flags field.  If it were a properly typechecked C function,
  that can't happen.

- These "functions" have odd names.  This:

	static inline void obj_created(struct exofs_i_info *ei)

  would be more Linux-like.

> +/*
> + * our extension to the in-memory inode
> + */
> +struct exofs_i_info {
> +	exofs_iflags_t i_flags;            /* various atomic flags            */
> +	__le32	       i_data[EXOFS_IDATA];/*short symlink names and device #s*/
> +	uint32_t       i_dir_start_lookup; /* which page to start lookup      */
> +	wait_queue_head_t i_wq;            /* wait queue for inode            */
> +	uint64_t       i_commit_size;      /* the object's written length     */
> +	uint8_t        i_cred[OSD_CAP_LEN];/* all-powerful credential         */
> +	struct inode   vfs_inode;          /* normal in-memory inode          */
> +};
> +
> +/*
> + * get to our inode from the vfs inode
> + */
> +static inline struct exofs_i_info *EXOFS_I(struct inode *inode)
> +{
> +	return container_of(inode, struct exofs_i_info, vfs_inode);
> +}

yeah, well.  We got lazy when, we converted EXT2_I from a macro to a C
function.  That doesn't mean that the mistake should have been copied :)
exofs_i() would be a more suitable name.

> +/*************************
> + * function declarations *
> + *************************/
>
> ...
>
> +#include <scsi/scsi_device.h>
> +#include <scsi/osd_sense.h>
> +
> +#include "exofs.h"
> +
> +int check_ok(struct osd_request *req)

eek.  This is a kernel-wide symbol.  The choice of identifier is bad.

> +{
> +	struct osd_sense_info osi;
> +	int ret = osd_req_decode_sense(req, &osi);
> +
> +	if (ret) { /* translate to Linux codes */
> +		if (osi.additional_code == scsi_invalid_field_in_cdb) {
> +			if (osi.cdb_field_offset == OSD_CFO_STARTING_BYTE)
> +				ret = -EFAULT;
> +			if (osi.cdb_field_offset == OSD_CFO_OBJECT_ID)
> +				ret = -ENOENT;
> +			else
> +				ret = -EINVAL;
> +		} else if (osi.additional_code == osd_quota_error)
> +			ret = -ENOSPC;
> +		else
> +			ret = -EIO;
> +	}
> +
> +	return ret;
> +}
> +
> +void make_credential(uint8_t cred_a[OSD_CAP_LEN], uint64_t pid, uint64_t oid)

Ditto.  I suspect I'm going to see a lot of this.  Please review the
entire fs for its namespace niceness

> +{
> +	struct osd_obj_id obj = {
> +		.partition = pid,
> +		.id = oid
> +	};
> +
> +	osd_sec_init_nosec_doall_caps(cred_a, &obj, false, true);
> +}
> +
>
> ...
>
> +int prepare_get_attr_list_add_entry(struct osd_request *req,
> +				    uint32_t page_num,
> +				    uint32_t attr_num,
> +				    uint32_t attr_len)
> +{
> +	struct osd_attr attr = {
> +		.page = page_num,

Kernel developers expect a field called "page" to have type `struct
page *'.  osd_attr.page is thus designed to confuse.

>
> ...
>


  reply	other threads:[~2008-12-29 20:30 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-16 14:48 [PATCHSET 0/9] exofs (was osdfs) Boaz Harrosh
2008-12-16 14:52 ` [PATCH 1/9] exofs: osd Swiss army knife Boaz Harrosh
2008-12-29 20:29   ` Andrew Morton [this message]
2008-12-31 15:33     ` Boaz Harrosh
2008-12-31 19:26       ` Andrew Morton
2009-01-01 14:44         ` Boaz Harrosh
2009-01-02 16:52     ` Pavel Machek
2009-01-04  8:43       ` Boaz Harrosh
2009-01-04 20:03         ` Pavel Machek
2009-01-05  9:01           ` Boaz Harrosh
2009-01-05  9:36             ` Pavel Machek
2008-12-16 15:15 ` Boaz Harrosh
2009-01-07 15:47   ` [osd-dev] " Benny Halevy
2009-01-13 13:55     ` Alan Cox
2009-01-13 14:43       ` Boaz Harrosh
2009-01-13 14:52         ` Boaz Harrosh
2009-01-13 15:09       ` Jamie Lokier
2009-01-13 15:17         ` Jeff Garzik
2009-01-13 15:28           ` Benny Halevy
2008-12-16 15:17 ` [PATCH 2/9] exofs: file and file_inode operations Boaz Harrosh
2008-12-29 20:34   ` Andrew Morton
2008-12-31 15:36     ` Boaz Harrosh
2008-12-16 15:21 ` [PATCH 3/9] exofs: symlink_inode and fast_symlink_inode operations Boaz Harrosh
2008-12-29 20:35   ` Andrew Morton
2008-12-16 15:22 ` [PATCH 4/9] exofs: address_space_operations Boaz Harrosh
2008-12-29 20:45   ` Andrew Morton
2008-12-31 15:35     ` Boaz Harrosh
2008-12-16 15:28 ` [PATCH 5/9] exofs: dir_inode and directory operations Boaz Harrosh
2008-12-29 20:47   ` Andrew Morton
2008-12-31 15:33     ` Boaz Harrosh
2008-12-16 15:31 ` [PATCH 6/9] exofs: super_operations and file_system_type Boaz Harrosh
2008-12-17 22:23   ` Marcin Slusarz
2008-12-18  8:41     ` Boaz Harrosh
2008-12-29 20:50   ` Andrew Morton
2008-12-16 15:33 ` [PATCH 7/9] exofs: mkexofs Boaz Harrosh
2008-12-29 20:14   ` Andrew Morton
2008-12-31 15:19     ` Boaz Harrosh
2008-12-31 15:57       ` James Bottomley
2009-01-01  9:22         ` [osd-dev] " Benny Halevy
2009-01-01  9:54           ` Jeff Garzik
2009-01-01 14:23             ` Benny Halevy
2009-01-01 14:28               ` Matthew Wilcox
2009-01-01 18:12               ` Jörn Engel
2009-01-01 23:26           ` J. Bruce Fields
2009-01-02  7:14             ` Benny Halevy
2009-01-04 15:20         ` Boaz Harrosh
2009-01-04 15:38           ` Christoph Hellwig
2009-01-12 18:12           ` James Bottomley
2009-01-12 19:23             ` Jeff Garzik
2009-01-12 19:56               ` James Bottomley
2009-01-12 20:22                 ` Jeff Garzik
2009-01-12 23:25                   ` James Bottomley
2009-01-13 13:03                     ` [osd-dev] " Benny Halevy
2009-01-13 13:24                       ` Jeff Garzik
2009-01-13 13:32                         ` Benny Halevy
2009-01-13 13:44                     ` Jeff Garzik
2009-01-13 14:03                       ` Alan Cox
2009-01-13 14:17                         ` Jeff Garzik
2009-01-13 16:14                           ` Alan Cox
2009-01-13 17:21                             ` Boaz Harrosh
2009-01-21 18:13                               ` Jeff Garzik
2009-01-21 18:44                                 ` Boaz Harrosh
2009-01-12 22:48             ` Jamie Lokier
2009-01-06  8:40         ` Andreas Dilger
2008-12-31 19:25       ` Andrew Morton
2009-01-01 13:33         ` Boaz Harrosh
2009-01-02 22:46           ` James Bottomley
2009-01-04  8:59             ` Boaz Harrosh
2008-12-16 15:36 ` [PATCH 8/9] exofs: Documentation Boaz Harrosh
2008-12-18  7:47   ` Pavel Machek
2008-12-18  8:32     ` Boaz Harrosh
2008-12-16 15:38 ` [PATCH 9/9] fs: Add exofs to Kernel build Boaz Harrosh

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=20081229122959.2cb48cf7.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=avishay@gmail.com \
    --cc=bharrosh@panasas.com \
    --cc=jeff@garzik.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=osd-dev@open-osd.org \
    --cc=viro@ZenIV.linux.org.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox