Whamcloud - gitweb
some cleanups and clarifications (a by-product of object index dld)
authornikita <nikita>
Fri, 14 Jul 2006 16:03:44 +0000 (16:03 +0000)
committernikita <nikita>
Fri, 14 Jul 2006 16:03:44 +0000 (16:03 +0000)
lustre/osd/osd_handler.c
lustre/osd/osd_oi.c
lustre/osd/osd_oi.h

index 230a700..1c1f79f 100644 (file)
@@ -1335,8 +1335,7 @@ static struct inode *osd_iget(struct osd_thread_info *info,
                 CERROR("bad inode\n");
                iput(inode);
                inode = ERR_PTR(-ENOENT);
-       } else if (inode->i_generation != id->oii_gen &&
-                   id->oii_gen != OSD_GEN_IGNORE) {
+       } else if (inode->i_generation != id->oii_gen) {
                 CERROR("stale inode\n");
                iput(inode);
                inode = ERR_PTR(-ESTALE);
@@ -1380,6 +1379,13 @@ static int osd_fid_lookup(const struct lu_context *ctx,
                         LASSERT(obj->oo_inode->i_sb == osd_sb(dev));
                         result = 0;
                 } else
+                        /*
+                         * If fid wasn't found in oi, inode-less object is
+                         * created, for which lu_object_exists() returns
+                         * false. This is used in a (frequent) case when
+                         * objects are created as locking anchors or
+                         * place holders for objects yet to be created.
+                         */
                         result = PTR_ERR(inode);
         } else if (result == -ENOENT)
                 result = 0;
index 8044091..d4e94f0 100644 (file)
  *   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *   license text for more details.
  */
+/*
+ * oi uses two mechanisms to implement fid->cookie mapping:
+ *
+ *     - persistent index, where cookie is a record and fid is a key, and
+ *
+ *     - algorithmic mapping for "igif" fids.
+ *
+ */
 
 #ifndef EXPORT_SYMTAB
 # define EXPORT_SYMTAB
@@ -167,7 +175,8 @@ int osd_oi_insert(struct osd_thread_info *info, struct osd_oi *oi,
         struct dt_device    *dev;
         struct osd_inode_id *id;
 
-        LASSERT(oi->oi_boot == NULL);
+        if (lu_fid_is_igif(fid))
+                return 0;
 
         idx = oi->oi_dir;
         dev = lu2dt_dev(idx->do_lu.lo_dev);
@@ -189,7 +198,8 @@ int osd_oi_delete(struct osd_thread_info *info,
         struct dt_object *idx;
         struct dt_device *dev;
 
-        LASSERT(oi->oi_boot == NULL);
+        if (lu_fid_is_igif(fid))
+                return 0;
 
         idx = oi->oi_dir;
         dev = lu2dt_dev(idx->do_lu.lo_dev);
index b7476eb..e565c30 100644 (file)
  *   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *   license text for more details.
  */
+/*
+ * Object Index (oi) service runs in the bottom layer of server stack. In
+ * translates fid local to this service to the storage cookie that uniquely
+ * and efficiently identifies object (inode) of the underlying file system.
+ */
 
 #ifndef _OSD_OI_H
 #define _OSD_OI_H
@@ -40,23 +45,33 @@ struct osd_thread_info;
 struct lu_site;
 struct thandle;
 
-struct oi_boot_rec;
 struct osd_device;
 
+/*
+ * Object Index (oi) instance.
+ */
 struct osd_oi {
+        /*
+         * underlying index object, where fid->id mapping in stored.
+         */
         struct dt_object    *oi_dir;
+        /*
+         * semaphore, synchronizing access to oi.
+         */
         struct rw_semaphore  oi_lock;
-        struct oi_boot_rec  *oi_boot;
 };
 
+/*
+ * Storage cookie. Datum uniquely identifying inode on the underlying file
+ * system.
+ *
+ * XXX Currently this is ext2/ext3/ldiskfs specific thing. In the future this
+ * should be generalized to work with other local file systems.
+ */
 struct osd_inode_id {
-        __u64 oii_ino;
-        __u32 oii_gen;
-        __u32 oii_pad;
-};
-
-enum {
-        OSD_GEN_IGNORE = (__u32)~0
+        __u64 oii_ino; /* inode number */
+        __u32 oii_gen; /* inode generation */
+        __u32 oii_pad; /* alignment padding */
 };
 
 int  osd_oi_init(struct osd_thread_info *info,