Whamcloud - gitweb
Branch b1_4
authoradilger <adilger>
Wed, 6 Jul 2005 05:39:01 +0000 (05:39 +0000)
committeradilger <adilger>
Wed, 6 Jul 2005 05:39:01 +0000 (05:39 +0000)
This merges a change from b1_4_quota that was never landed on b1_4, which
removes some extraneous quota-induced overhead in the llap structs, growing
the size of each one noticably (and there are a lot of them, one per page).
It also removes an extra set of upcalls per page.
b=6929
r=niu

12 files changed:
lustre/include/linux/obd.h
lustre/liblustre/rw.c
lustre/liblustre/super.c
lustre/llite/llite_internal.h
lustre/llite/rw.c
lustre/mds/mds_internal.h
lustre/mds/mds_unlink_open.c
lustre/obdfilter/filter_internal.h
lustre/obdfilter/filter_io.c
lustre/obdfilter/filter_io_26.c
lustre/osc/osc_internal.h
lustre/utils/wiretest.c

index fdfcf52..033f9c5 100644 (file)
@@ -130,7 +130,6 @@ struct obd_async_page_ops {
         int  (*ap_refresh_count)(void *data, int cmd);
         void (*ap_fill_obdo)(void *data, int cmd, struct obdo *oa);
         void (*ap_completion)(void *data, int cmd, struct obdo *oa, int rc);
-        void (*ap_get_ucred)(void *data, struct lvfs_ucred *ouc);
 };
 
 /* the `oig' is passed down from a caller of obd rw methods.  the callee
index e2e0180..d56578a 100644 (file)
@@ -358,29 +358,11 @@ static void llu_ap_completion(void *data, int cmd, struct obdo *oa, int rc)
         EXIT;
 }
 
-static void llu_ap_get_ucred(void *data, struct lvfs_ucred *luc)
-{
-        struct ll_async_page *llap;
-        struct ll_uctxt ctxt;
-        ENTRY; 
-        
-        llap = LLAP_FROM_COOKIE(data);
-        
-        luc->luc_fsuid = current->fsuid;
-        luc->luc_fsgid = current->fsgid;
-        luc->luc_cap = current->cap_effective;
-        ll_i2uctxt(&ctxt, llap->llap_inode, NULL);
-        luc->luc_suppgid1 = ctxt.gid1;
-        
-        EXIT;
-}
-
 static struct obd_async_page_ops llu_async_page_ops = {
         .ap_make_ready =        NULL,
         .ap_refresh_count =     NULL,
         .ap_fill_obdo =         llu_ap_fill_obdo,
         .ap_completion =        llu_ap_completion,
-        .ap_get_ucred =         llu_ap_get_ucred,
 };
 
 static int llu_queue_pio(int cmd, struct llu_io_group *group,
index 5dcd3b8..3dcafa3 100644 (file)
@@ -1509,11 +1509,11 @@ static int llu_put_grouplock(struct inode *inode, unsigned long arg)
 static int llu_iop_ioctl(struct inode *ino, unsigned long int request,
                          va_list ap)
 {
+        unsigned long arg;
 
         liblustre_wait_event(0);
 
         switch (request) {
-        unsigned long arg;
         case LL_IOC_GROUP_LOCK:
                 arg = va_arg(ap, unsigned long);
                 return llu_get_grouplock(ino, arg);
index 19ef784..6af329b 100644 (file)
@@ -230,8 +230,6 @@ struct ll_async_page {
         struct page     *llap_page;
         struct list_head llap_pending_write;
         struct list_head llap_pglist_item;
-        /* user credit information for oss enforcement quota */
-        struct lvfs_ucred llap_ouc;
         /* checksum for paranoid I/O debugging */
         __u32 llap_checksum;
 };
index 4a59682..d7f721e 100644 (file)
@@ -367,26 +367,11 @@ static void ll_ap_fill_obdo(void *data, int cmd, struct obdo *oa)
         EXIT;
 }
 
-static void ll_ap_get_ucred(void *data, struct lvfs_ucred *ouc)
-{
-        struct ll_async_page *llap;
-
-        llap = LLAP_FROM_COOKIE(data);
-        if (IS_ERR(llap)) {
-                EXIT;
-                return;
-        }
-
-        memcpy(ouc, &llap->llap_ouc, sizeof(*ouc));
-        EXIT;
-}
-
 static struct obd_async_page_ops ll_async_page_ops = {
         .ap_make_ready =        ll_ap_make_ready,
         .ap_refresh_count =     ll_ap_refresh_count,
         .ap_fill_obdo =         ll_ap_fill_obdo,
         .ap_completion =        ll_ap_completion,
-        .ap_get_ucred =         ll_ap_get_ucred,
 };
 
 struct ll_async_page *llap_cast_private(struct page *page)
@@ -683,7 +668,6 @@ int ll_commit_write(struct file *file, struct page *page, unsigned from,
         struct lov_stripe_md *lsm = lli->lli_smd;
         struct obd_export *exp;
         struct ll_async_page *llap;
-        struct ll_uctxt ctxt;
         loff_t size;
         int rc = 0;
         ENTRY;
@@ -703,13 +687,6 @@ int ll_commit_write(struct file *file, struct page *page, unsigned from,
         if (exp == NULL)
                 RETURN(-EINVAL);
 
-        /* set user credit information for this page */
-        llap->llap_ouc.luc_fsuid = current->fsuid;
-        llap->llap_ouc.luc_fsgid = current->fsgid;
-        llap->llap_ouc.luc_cap = current->cap_effective;
-        ll_i2uctxt(&ctxt, inode, NULL);
-        llap->llap_ouc.luc_suppgid1 = ctxt.gid1;
-
         /* queue a write for some time in the future the first time we
          * dirty the page */
         if (!PageDirty(page)) {
index ceca1cb..f57ac96 100644 (file)
@@ -197,7 +197,7 @@ void mds_pack_inode2body(struct mds_body *body, struct inode *inode);
 int lustre_dquot_init(void);
 void lustre_dquot_exit(void);
 int dqacq_handler(struct obd_device *obd, struct qunit_data *qdata, int opc);
-void mds_adjust_qunit(struct obd_device *obd, uid_t cuid, gid_t cgid, 
+void mds_adjust_qunit(struct obd_device *obd, uid_t cuid, gid_t cgid,
                      uid_t puid, gid_t pgid, int rc);
 int init_admin_quotafiles(struct obd_device *obd, struct obd_quotactl *oqctl);
 int mds_quota_on(struct obd_device *obd, struct obd_quotactl *oqctl);
@@ -209,24 +209,24 @@ int mds_get_dqblk(struct obd_device *obd, struct obd_quotactl *oqctl);
 #else
 static inline int lustre_dquot_init(void) { return 0; }
 static inline void lustre_dquot_exit(void) { return; }
-static inline int dqacq_handler(struct obd_device *obd, 
+static inline int dqacq_handler(struct obd_device *obd,
                                 struct qunit_data *qdata, int opc) {return 0;}
-static inline void mds_adjust_qunit(struct obd_device *obd, uid_t cuid, 
-                                    gid_t cgid, uid_t puid, 
+static inline void mds_adjust_qunit(struct obd_device *obd, uid_t cuid,
+                                    gid_t cgid, uid_t puid,
                                     gid_t pgid, int rc) { return; }
-static inline int init_admin_quotafiles(struct obd_device *obd, 
+static inline int init_admin_quotafiles(struct obd_device *obd,
                                         struct obd_quotactl *oqctl) {return 0;}
-static inline int mds_quota_on(struct obd_device *obd, 
+static inline int mds_quota_on(struct obd_device *obd,
                                struct obd_quotactl *oqctl) { return 0; }
-static inline int mds_quota_off(struct obd_device *obd, 
+static inline int mds_quota_off(struct obd_device *obd,
                                 struct obd_quotactl *oqctl) { return 0; }
-static inline int mds_set_dqinfo(struct obd_device *obd, 
+static inline int mds_set_dqinfo(struct obd_device *obd,
                                  struct obd_quotactl *oqctl) { return 0; }
-static inline int mds_get_dqinfo(struct obd_device *obd, 
+static inline int mds_get_dqinfo(struct obd_device *obd,
                                  struct obd_quotactl *oqctl) { return 0; }
-static inline int mds_set_dqblk(struct obd_device *obd, 
+static inline int mds_set_dqblk(struct obd_device *obd,
                                 struct obd_quotactl *oqctl) { return 0; }
-static inline int mds_get_dqblk(struct obd_device *obd, 
+static inline int mds_get_dqblk(struct obd_device *obd,
                                 struct obd_quotactl *oqctl) { return 0; }
 #endif /* KERNEL_VERSION(2,5,0) && QUOTA */
 
index 6298eb4..ef80dfc 100644 (file)
@@ -174,6 +174,8 @@ int mds_cleanup_orphans(struct obd_device *obd)
         ENTRY;
 
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+        /* dentry and mnt ref dropped in dentry_open() on error, or
+         * in filp_close() if dentry_open() succeeds */
         dentry = dget(mds->mds_pending_dir);
         if (IS_ERR(dentry))
                 GOTO(err_pop, rc = PTR_ERR(dentry));
index 1c30fbc..2fe4d3d 100644 (file)
@@ -185,7 +185,7 @@ static inline void filter_tally_write(struct filter_obd *filter,
                                  unsigned long *blocks, int blocks_per_page) {}
 static inline void filter_tally_read(struct filter_obd *filter,
                                      struct niobuf_local *lnb, int niocount) {}
-static inline int lproc_filter_attach_seqstat(struct obd_device *dev) {};
+static inline int lproc_filter_attach_seqstat(struct obd_device *dev) {}
 #endif
 
 /* Quota stuff */
@@ -219,36 +219,41 @@ int lprocfs_filter_wr_btune(struct file *file, const char *buffer,
 int lprocfs_filter_wr_itune(struct file *file, const char *buffer,
                                    unsigned long count, void *data);
 #endif /* LPROCFS */
-#else /* Quota */
+#else /* !HAVE_QUOTA_SUPPORT */
 static inline int filter_quota_setup(struct filter_obd *filter)
 {
         return 0;
 }
 static inline void filter_quota_cleanup(struct filter_obd *filter) {}
-static inline void filter_quota_set_info(struct obd_export *exp, struct obd_device *obd) {}
-static inline int filter_quotacheck(struct obd_export *exp, struct obd_quotactl *oqctl)
+static inline void filter_quota_set_info(struct obd_export *exp,
+                                         struct obd_device *obd) {}
+static inline int filter_quotacheck(struct obd_export *exp,
+                                    struct obd_quotactl *oqctl)
 {
         return -ENOTSUPP;
 }
-static inline int filter_quotactl(struct obd_export *exp, struct obd_quotactl *oqctl)
+static inline int filter_quotactl(struct obd_export *exp,
+                                  struct obd_quotactl *oqctl)
 {
         return -ENOTSUPP;
 }
 static inline int filter_quota_enforcement(struct obd_device *obd,
-                                    unsigned int fsuid, unsigned int fsgid,
-                                    struct lvfs_ucred **ret_uc)
+                                           unsigned int fsuid,
+                                           unsigned int fsgid,
+                                           struct lvfs_ucred **ret_uc)
 {
         return 0;
 }
 static inline int filter_get_quota_flag(struct obd_device *obd,
-                                 struct obdo *oa)
+                                        struct obdo *oa)
 {
         return 0;
 }
-static inline int filter_quota_check_master(struct obd_device *obd, struct inode *inode)
+static inline int filter_quota_check_master(struct obd_device *obd,
+                                            struct inode *inode)
 {
         return 0;
 }
-#endif /* Quota */
+#endif /* HAVE_QUOTA_SUPPORT */
 
-#endif
+#endif /* _FILTER_INTERNAL_H */
index 88e2dfa..4970169 100644 (file)
@@ -649,9 +649,9 @@ cleanup:
                 if (rc)
                         filter_free_dio_pages(objcount, obj, niocount, res);
         case 3:
-                pop_ctxt(&saved, &exp->exp_obd->obd_lvfs_ctxt, NULL);
                 filter_free_iobuf(iobuf);
         case 2:
+                pop_ctxt(&saved, &exp->exp_obd->obd_lvfs_ctxt, NULL);
                 if (rc)
                         f_dput(dentry);
                 break;
index a706583..311ea15 100644 (file)
@@ -171,11 +171,11 @@ int filter_alloc_iobuf(struct filter_obd *filter, int rw, int num_pages,
         OBD_ALLOC(dreq, sizeof(*dreq));
         if (dreq == NULL)
                 goto failed_0;
-        
+
         OBD_ALLOC(dreq->dr_pages, num_pages * sizeof(*dreq->dr_pages));
         if (dreq->dr_pages == NULL)
                 goto failed_1;
-        
+
         OBD_ALLOC(dreq->dr_blocks,
                   MAX_BLOCKS_PER_PAGE * num_pages * sizeof(*dreq->dr_blocks));
         if (dreq->dr_blocks == NULL)
@@ -424,13 +424,6 @@ int filter_direct_io(int rw, struct dentry *dchild, void *iobuf,
         if (dreq->dr_npages == 0)
                 RETURN(0);
 
-        /* If there is any page in this write rpc that comes from client
-         * cache, we write the whole rpc without quota limit */
-        if (dreq->dr_flag & OBD_BRW_FROM_GRANT) {
-                cap_raise(current->cap_effective, CAP_SYS_RESOURCE);
-                dreq->dr_flag &= ~OBD_BRW_FROM_GRANT;
-        }
-
 remap:
         rc = fsfilt_map_inode_pages(obd, inode,
                                     dreq->dr_pages, dreq->dr_npages,
@@ -528,7 +521,7 @@ int filter_commitrw_write(struct obd_export *exp, struct obdo *oa,
 
         if (rc != 0)
                 GOTO(cleanup, rc);
-        
+
         rc = filter_alloc_iobuf(&obd->u.filter, OBD_BRW_WRITE, obj->ioo_bufcnt,
                                 (void **)&dreq);
         if (rc)
@@ -562,10 +555,6 @@ int filter_commitrw_write(struct obd_export *exp, struct obdo *oa,
                 this_size = lnb->offset + lnb->len;
                 if (this_size > iattr.ia_size)
                         iattr.ia_size = this_size;
-                /* if one page is a write-back page from client cache,
-                 * then mark that the whole io request can be over quota */
-                if (lnb->flags & OBD_BRW_FROM_GRANT)
-                        dreq->dr_flag |= OBD_BRW_FROM_GRANT;
         }
 
         /* The client store the user credit information fsuid and fsgid
index 60e9160..6c6d385 100644 (file)
@@ -32,8 +32,8 @@ struct osc_async_page {
         void                    *oap_caller_data;
 };
 
-#define OAP_FROM_COOKIE(c)                                                      \
-        (LASSERT(((struct osc_async_page *)(c))->oap_magic == OAP_MAGIC),       \
+#define OAP_FROM_COOKIE(c)                                                    \
+        (LASSERT(((struct osc_async_page *)(c))->oap_magic == OAP_MAGIC),     \
          (struct osc_async_page *)(c))
 
 struct osc_cache_waiter {
@@ -69,15 +69,15 @@ void osc_qinfo_exit(void);
 int osc_quotacheck(struct obd_export *exp, struct obd_quotactl *oqctl);
 int osc_poll_quotacheck(struct obd_export *exp, struct if_quotacheck *qchk);
 int osc_quotactl(struct obd_export *exp, struct obd_quotactl *oqctl);
-#else
+#else /* !HAVE_QUOTA_SUPPORT */
 static inline int osc_get_quota_flag(struct client_obd *cli,
-                       unsigned int uid, unsigned int gid)
+                                     unsigned int uid, unsigned int gid)
 {
        return QUOTA_OK;
 }
 static inline int osc_set_quota_flag(struct client_obd *cli,
-                       unsigned int uid, unsigned int gid,
-                       obd_flag valid, obd_flag flags)
+                                     unsigned int uid, unsigned int gid,
+                                     obd_flag valid, obd_flag flags)
 {
         return 0;
 }
@@ -90,19 +90,22 @@ static inline int osc_qinfo_init(void)
         return 0;
 }
 static inline void osc_qinfo_exit(void) {}
-static inline int osc_quotacheck(struct obd_export *exp, struct obd_quotactl *oqctl)
+static inline int osc_quotacheck(struct obd_export *exp,
+                                 struct obd_quotactl *oqctl)
 {
         return -ENOTSUPP;
 }
-static inline int osc_poll_quotacheck(struct obd_export *exp, struct if_quotacheck *qchk)
+static inline int osc_poll_quotacheck(struct obd_export *exp,
+                                      struct if_quotacheck *qchk)
 {
         return -ENOTSUPP;
 }
-static inline int osc_quotactl(struct obd_export *exp, struct obd_quotactl *oqctl)
+static inline int osc_quotactl(struct obd_export *exp,
+                               struct obd_quotactl *oqctl)
 {
         return -ENOTSUPP;
 }
-#endif
+#endif /* HAVE_QUOTA_SUPPORT */
 
 #ifdef LPROCFS
 int lproc_osc_attach_seqstat(struct obd_device *dev);
index f802c1a..922ecd6 100644 (file)
@@ -94,8 +94,6 @@ void lustre_assert_wire_constants(void)
                  (long long)OST_LAST_OPC);
         LASSERTF(OBD_OBJECT_EOF == 0xffffffffffffffffULL," found %lld\n",
                  (long long)OBD_OBJECT_EOF);
-        LASSERTF(OST_REQ_HAS_OA1 == 1, " found %lld\n",
-                 (long long)OST_REQ_HAS_OA1);
         LASSERTF(MDS_GETATTR == 33, " found %lld\n",
                  (long long)MDS_GETATTR);
         LASSERTF(MDS_GETATTR_NAME == 34, " found %lld\n",
@@ -1118,6 +1116,10 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)offsetof(struct ldlm_extent, end));
         LASSERTF((int)sizeof(((struct ldlm_extent *)0)->end) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct ldlm_extent *)0)->end));
+        LASSERTF((int)offsetof(struct ldlm_extent, gid) == 16, " found %lld\n",
+                 (long long)(int)offsetof(struct ldlm_extent, gid));
+        LASSERTF((int)sizeof(((struct ldlm_extent *)0)->gid) == 8, " found %lld\n",
+                 (long long)(int)sizeof(((struct ldlm_extent *)0)->gid));
 
         /* Checks for struct ldlm_flock */
         LASSERTF((int)sizeof(struct ldlm_flock) == 32, " found %lld\n",