lustre: PFL port to linux client
cover lustre: PFL port to linux client
This is the initial PFL port to the linux lustre client. This opens up feed back on the port so far. Currently sanity passes but the test for sanity-pfl fail as below. I have been tracking downing various bugs but this one remains and I haven't found out why its failing. So far from what I can tell is lov_io_setattr_iter_init() it returning -ENODATA due to lsm_entry_inited() is not initialized. Hoping that sending this out more eyes might help to see where this last problem is.
Lustre: DEBUG MARKER: == sanity-pfl test 0: Create full components file, no reused OSTs ======= ============================= 10:53:08 (1545061988)
Lustre: DEBUG MARKER: create directory /lustre/lustre/d0.sanity-pfl
Lustre: DEBUG MARKER: create comp_file
Lustre: DEBUG MARKER: instantiate components
LustreError: 19350:0:(cl_io.c:439:cl_io_iter_fini()) ASSERTION( io->ci_state == CIS_UNLOCKED ) failed:
LustreError: 19350:0:(cl_io.c:439:cl_io_iter_fini()) LBUG
Pid: 19350, comm: dd 4.20.0-rc6+ #1 SMP PREEMPT Sat Dec 15 11:22:06 EST 2018
Call Trace: libcfs_call_trace+0x8b/0xc0 [libcfs] lbug_with_loc+0x41/0x90 [libcfs] cl_io_iter_fini+0x10c/0x110 [obdclass] cl_io_loop+0x46/0x220 [obdclass] cl_setattr_ost+0x1ed/0x2a0 [lustre] ll_setattr_raw+0x797/0x980 [lustre] notify_change+0x1dc/0x430 do_truncate+0x72/0xc0 do_sys_ftruncate+0xf5/0x160 do_syscall_64+0x68/0x38f
Bobi Jam (20):
lustre: lov: move code for PFL work
lustre: lov: merge lov_mds_md_v3 and lov_mds_md_v1 handling
lustre: lov: fold lmm_verify() handling into lmm_unpackmd()
lustre: lov: create struct lov_stripe_md_entry
lustre: lov: add composite layout unpacking
lustre: lov: embedded raid0 in struct lov_layout_composite
lustre: lov: migrate lov raid0 to future PFL component handling
lustre: lov: reduce code indentation
lustre: lov: change lo_entries to array.
lustre: lov: move around PFL code and cleanups
lustre: lov: remove lsm_stripe_by_[index|offset]_plain
lustre: lov: add looping lsm_entry_count times
lustre: lov: create lov_comp_* wrappers
lustre: clio: client side implementation for PFL
lustre: pfl: dynamic layout modification with write/truncate
lustre: pfl: calculate PFL file LOVEA correctly
lustre: lov: keep minimum LOVEA size
lustre: pfl: fix hang with grouplocks
lustre: pfl: fix ost pool op->size handling
lustre: llite: restore ll_file_getstripe in ll_lov_setstripe
Fan Yong (1):
lustre: pfl: enhance PFID EA for PFL
Jinshan Xiong (3):
lustre: pfl: Read should not trigger layout write intent
lustre: lov: readahead shouldn't exceed component boundary
lustre: lov: do not split IO for single striped file
Niu Yawei (4):
lustre: pfl: Basic data structures for composite layout
lustre: clio: getstripe support comp layout
lustre: uapi: support negative flags
lustre: llite: return v1/v3 layout for legacy app
.../lustre/include/uapi/linux/lustre/lustre_idl.h | 36 +- .../lustre/include/uapi/linux/lustre/lustre_user.h | 88 ++- drivers/staging/lustre/lustre/include/cl_object.h | 12 +- drivers/staging/lustre/lustre/include/lustre_sec.h | 4 +- .../staging/lustre/lustre/include/lustre_swab.h | 1 + drivers/staging/lustre/lustre/include/obd.h | 4 - drivers/staging/lustre/lustre/llite/dir.c | 38 +- drivers/staging/lustre/lustre/llite/file.c | 185 +++-- .../staging/lustre/lustre/llite/llite_internal.h | 3 + drivers/staging/lustre/lustre/llite/vvp_io.c | 44 +- drivers/staging/lustre/lustre/llite/xattr.c | 70 +- .../staging/lustre/lustre/lov/lov_cl_internal.h | 191 ++--- drivers/staging/lustre/lustre/lov/lov_ea.c | 570 ++++++++++---- drivers/staging/lustre/lustre/lov/lov_internal.h | 175 +++-- drivers/staging/lustre/lustre/lov/lov_io.c | 651 +++++++++------- drivers/staging/lustre/lustre/lov/lov_lock.c | 94 ++- drivers/staging/lustre/lustre/lov/lov_merge.c | 12 +- drivers/staging/lustre/lustre/lov/lov_object.c | 833 ++++++++++++--------- drivers/staging/lustre/lustre/lov/lov_offset.c | 65 +- drivers/staging/lustre/lustre/lov/lov_pack.c | 364 +++++---- drivers/staging/lustre/lustre/lov/lov_page.c | 42 +- drivers/staging/lustre/lustre/lov/lov_pool.c | 20 +- drivers/staging/lustre/lustre/lov/lovsub_object.c | 23 +- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 79 +- drivers/staging/lustre/lustre/obdclass/cl_object.c | 5 +- drivers/staging/lustre/lustre/obdclass/genops.c | 16 +- drivers/staging/lustre/lustre/osc/osc_io.c | 4 +- drivers/staging/lustre/lustre/ptlrpc/layout.c | 6 +- .../staging/lustre/lustre/ptlrpc/pack_generic.c | 84 ++- .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 7 +- drivers/staging/lustre/lustre/ptlrpc/sec.c | 5 +- drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 125 +++- 32 files changed, 2483 insertions(+), 1373 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/28 lustre: pfl: Basic data structures for composite layout
From: Niu Yawei <[email protected]>
Added basic structures and magic numbers for composite layout.
WC-bug-id: https://jira.whamcloud.com/browse/LU-8998
Reviewed-on: https://review.whamcloud.com/24822
--- .../lustre/include/uapi/linux/lustre/lustre_idl.h | 1 + .../lustre/include/uapi/linux/lustre/lustre_user.h | 54 ++++++++++++++++ .../staging/lustre/lustre/include/lustre_swab.h | 1 + .../staging/lustre/lustre/ptlrpc/pack_generic.c | 71 ++++++++++++++++++++++ drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 67 ++++++++++++++++++++ 5 files changed, 194 insertions(+)
drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h +1 -0
@@ -960,6 +960,7 @@ enum obdo_flags {/* reserved for specifying OSTs */ #define LOV_MAGIC_SPECIFIC (0x0BD50000 | LOV_MAGIC_MAGIC)#define LOV_MAGIC LOV_MAGIC_V1 +#define LOV_MAGIC_COMP_V1 (0x0BD60000 | LOV_MAGIC_MAGIC)/* * magic for fully defined striping
drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h +54 -0
66 lines not on this page · raw message
drivers/staging/lustre/lustre/include/lustre_swab.h +1 -0
@@ -83,6 +83,7 @@void lustre_swab_fiemap (struct fiemap *fiemap);void lustre_swab_lov_user_md_v1 (struct lov_user_md_v1 *lum);void lustre_swab_lov_user_md_v3 (struct lov_user_md_v3 *lum); +void lustre_swab_lov_comp_md_v1 (struct lov_comp_md_v1 *lum);void lustre_swab_lov_user_md_objects (struct lov_user_ost_data *lod,int stripe_count);void lustre_swab_lov_mds_md (struct lov_mds_md *lmm);
drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +71 -0
77 lines not on this page · raw message
drivers/staging/lustre/lustre/ptlrpc/wiretest.c +67 -0
73 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 1/28 lustre: pfl: Basic data structures for composite layout
Quoted 4 lines · James Simmons
From: Niu Yawei <[email protected]>
Added basic structures and magic numbers for composite layout.
This would be a great place to (brief) explain what PFL does and what it is going to do with this data structures.
What are the "components" and how do they form a "composite layout" ??
drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h struct lov_user_md_v3 { /* LOV EA user data (host-endian) */ · line 412
Quoted 10 lines
drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h +10
-0+ +enum lov_comp_md_entry_flags { +LCME_FL_PRIMARY =0x00000001 ,/* Not used */ +LCME_FL_STALE =0x00000002 ,/* Not used */ +LCME_FL_OFFLINE =0x00000004 ,/* Not used */ +LCME_FL_PREFERRED =0x00000008 ,/* Not used */ +LCME_FL_INIT =0x00000010 ,/* instantiated */ +}; + +#define LCME_KNOWN_FLAGS LCME_FL_INIT
What is a "KNOWN" flags? What isn't known about the other ones?
Review
Quoted 2 lines
(quoted diff) +2
-0+ +/* lcme_id can be specified as certain flags, and the the first
^^^^^^^
Too many "the"s.
drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h struct lov_user_md_v3 { /* LOV EA user data (host-endian) */ · line 426
Quoted 12 lines
+ * bit of
lcme_idis used to indicate that the ID is representing
+ * certain LCME_FL_* but not a real ID. Which implies we can have
+ * at most 31 flags (seeLCME_FL_XXX).
+ */drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h +8
-0+enum lcme_id { +LCME_ID_INVAL =0x0 , +LCME_ID_MAX =0x7FFFFFFF , +LCME_ID_ALL =0xFFFFFFFF , +LCME_ID_NONE =0x80000000 +}; + +#define LCME_ID_MASK LCME_ID_MAX
Why is MASK a #define, but MAX an enum ??
drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h struct lov_user_md_v3 { /* LOV EA user data (host-endian) */ · line 439
Quoted 13 lines
drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h +13
-0+ +struct lov_comp_md_entry_v1 { +__u32 lcme_id;/* unique id of component */ +__u32 lcme_flags;/* LCME_FL_XXX */ +struct lu_extent lcme_extent;/* file extent for component */ +__u32 lcme_offset;/* offset of component blob, +* start from lov_comp_md_v1 +*/ +__u32 lcme_size;/* size of component blob */ +__u64 lcme_padding[2 ]; +} __packed; + +enum lov_comp_md_flags ;
This enum is empty, and never used.
It eventually gets some LCM_FL_* names added... maybe it should wait until those are added??
Thanks,
NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20181218/c1c61bb3/attachment.sig>
PATCH 1/28 lustre: pfl: Basic data structures for composite layout
Re: KNOWN.
These are on disk flags. It?s a mask used to check for unknown flags.
________________________________
From: lustre-devel <[email protected]> on behalf of NeilBrown <[email protected]>
Sent: Monday, December 17, 2018 5:54:41 PM
To: James Simmons; Andreas Dilger; Oleg Drokin; Bobi Jam; Jinshan Xiong
Cc: Lustre Development List
Subject: Re: [lustre-devel] [PATCH 01/28] lustre: pfl: Basic data structures for composite layout
Quoted 4 lines · James Simmons
From: Niu Yawei <[email protected]>
Added basic structures and magic numbers for composite layout.
This would be a great place to (brief) explain what PFL does and what it is going to do with this data structures.
What are the "components" and how do they form a "composite layout" ??
drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h struct lov_user_md_v3 { /* LOV EA user data (host-endian) */ · line 412
Quoted 10 lines
drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h +10
-0+ +enum lov_comp_md_entry_flags { +LCME_FL_PRIMARY =0x00000001 ,/* Not used */ +LCME_FL_STALE =0x00000002 ,/* Not used */ +LCME_FL_OFFLINE =0x00000004 ,/* Not used */ +LCME_FL_PREFERRED =0x00000008 ,/* Not used */ +LCME_FL_INIT =0x00000010 ,/* instantiated */ +}; + +#define LCME_KNOWN_FLAGS LCME_FL_INIT
What is a "KNOWN" flags? What isn't known about the other ones?
Review
Quoted 2 lines
(quoted diff) +2
-0+ +/* lcme_id can be specified as certain flags, and the the first
^^^^^^^
Too many "the"s.
drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h struct lov_user_md_v3 { /* LOV EA user data (host-endian) */ · line 426
Quoted 12 lines
+ * bit of
lcme_idis used to indicate that the ID is representing
+ * certain LCME_FL_* but not a real ID. Which implies we can have
+ * at most 31 flags (seeLCME_FL_XXX).
+ */drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h +8
-0+enum lcme_id { +LCME_ID_INVAL =0x0 , +LCME_ID_MAX =0x7FFFFFFF , +LCME_ID_ALL =0xFFFFFFFF , +LCME_ID_NONE =0x80000000 +}; + +#define LCME_ID_MASK LCME_ID_MAX
Why is MASK a #define, but MAX an enum ??
drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h struct lov_user_md_v3 { /* LOV EA user data (host-endian) */ · line 439
Quoted 13 lines
drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h +13
-0+ +struct lov_comp_md_entry_v1 { +__u32 lcme_id;/* unique id of component */ +__u32 lcme_flags;/* LCME_FL_XXX */ +struct lu_extent lcme_extent;/* file extent for component */ +__u32 lcme_offset;/* offset of component blob, +* start from lov_comp_md_v1 +*/ +__u32 lcme_size;/* size of component blob */ +__u64 lcme_padding[2 ]; +} __packed; + +enum lov_comp_md_flags ;
This enum is empty, and never used.
It eventually gets some LCM_FL_* names added... maybe it should wait until those are added??
Thanks,
NeilBrown
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20181218/09b52b51/attachment.html>
PATCH 1/28 lustre: pfl: Basic data structures for composite layout
In reply to NeilBrownQuoted 9 lines
Quoted 5 lines
From: Niu Yawei <[email protected]>
Added basic structures and magic numbers for composite layout.
This would be a great place to (brief) explain what PFL does and what it is going to do with this data structures.
What are the "components" and how do they form a "composite layout" ??
Would the link - http://wiki.lustre.org/PFL_Prototype_High_Level_Design
be enough ?
Quoted 4 lines
Quoted 4 lines
drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h +4
-0+ +enum lov_comp_md_entry_flags { +LCME_FL_PRIMARY =0x00000001 ,/* Not used */ +LCME_FL_STALE =0x00000002 ,/* Not used */
Quoted 8 lines
drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h struct lov_user_md_v3 { /* LOV EA user data (host-endian) */ · line 412
Quoted 6 lines
drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h +6
-0+LCME_FL_OFFLINE =0x00000004 ,/* Not used */ +LCME_FL_PREFERRED =0x00000008 ,/* Not used */ + LCME_FL_INIT = 0x00000010, /* instantiated */ +}; + +#define LCME_KNOWN_FLAGS LCME_FL_INITWhat is a "KNOWN" flags? What isn't known about the other ones?
Patrick answered this one :-)
Quoted 6 lines
Quoted 6 lines
+ * bit of
lcme_idis used to indicate that the ID is representing
+ * certain LCME_FL_* but not a real ID. Which implies we can have
+ * at most 31 flags (seeLCME_FL_XXX).
+ */drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h +2
-0+enum lcme_id { +LCME_ID_INVAL =0x0 ,
Quoted 8 lines
drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h struct lov_user_md_v3 { /* LOV EA user data (host-endian) */ · line 426
Quoted 6 lines
drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h +6
-0+LCME_ID_MAX =0x7FFFFFFF , +LCME_ID_ALL =0xFFFFFFFF , + LCME_ID_NONE = 0x80000000 +}; + +#define LCME_ID_MASK LCME_ID_MAXWhy is MASK a #define, but MAX an enum ??
Actually I looked and this mask is only needed for server code. Sadly developers are still using lustre_idl.h and lustre_user.h as dumpsters :-( Will remove.
Quoted 16 lines
drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h struct lov_user_md_v3 { /* LOV EA user data (host-endian) */ · line 439
Quoted 13 lines
drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h +13
-0+ +struct lov_comp_md_entry_v1 { +__u32 lcme_id;/* unique id of component */ +__u32 lcme_flags;/* LCME_FL_XXX */ +struct lu_extent lcme_extent;/* file extent for component */ +__u32 lcme_offset;/* offset of component blob, +* start from lov_comp_md_v1 +*/ +__u32 lcme_size;/* size of component blob */ +__u64 lcme_padding[2 ]; +} __packed; + +enum lov_comp_md_flags ;This enum is empty, and never used.
Quoted 2 lines
It eventually gets some LCM_FL_* names added... maybe it should wait until those are added??
Also removed. Strange this exist in the 2.10 branch but its not used.
PATCH 2/28 lustre: lov: move code for PFL work
In reply to James SimmonsFrom: Bobi Jam <[email protected]>
Move lov_tgt_maxbytes() and lsm_free_plain() toward the top of lov_ea.c for upcoming PFL work.
WC-bug-id: https://jira.whamcloud.com/browse/LU-8998
Reviewed-on: https://review.whamcloud.com/24849
--- drivers/staging/lustre/lustre/lov/lov_ea.c | 87 ++++++++++++++---------- drivers/staging/lustre/lustre/lov/lov_internal.h | 16 +---- 2 files changed, 51 insertions(+), 52 deletions(-)
drivers/staging/lustre/lustre/lov/lov_ea.c +50 -37
@@ -44,6 +44,33 @@#include "lov_internal.h" +/* +* Find minimum stripe maxbytes value. For inactive or +* reconnecting targets use LUSTRE_EXT3_STRIPE_MAXBYTES. +*/ +static loff_t lov_tgt_maxbytes (struct lov_tgt_desc *tgt) +{ +loff_t maxbytes =LUSTRE_EXT3_STRIPE_MAXBYTES ; +struct obd_import *imp; + +if (!tgt->ltd_active) +return maxbytes; + + imp = tgt->ltd_obd->u.cli.cl_import; +if (!imp) +return maxbytes; + +spin_lock (&imp->imp_lock); +if (imp->imp_state ==LUSTRE_IMP_FULL && + (imp->imp_connect_data.ocd_connect_flags &OBD_CONNECT_MAXBYTES ) && + imp->imp_connect_data.ocd_maxbytes >0 ) + maxbytes = imp->imp_connect_data.ocd_maxbytes; + +spin_unlock (&imp->imp_lock); + +return maxbytes; +} +static int lsm_lmm_verify_common (struct lov_mds_md *lmm,int lmm_bytes,__u16 stripe_count) {
@@ -76,6 +103,16 @@ static int lsm_lmm_verify_common(struct lov_mds_md *lmm, int lmm_bytes,return 0 ; } +void lsm_free_plain (struct lov_stripe_md *lsm) +{ +__u16 stripe_count = lsm->lsm_stripe_count; +int i; + +for (i =0 ; i < stripe_count; i++) +kmem_cache_free (lov_oinfo_slab, lsm->lsm_oinfo[i]); +kvfree (lsm); +} +struct lov_stripe_md *lsm_alloc_plain (u16 stripe_count) {size_t oinfo_ptrs_size, lsm_size;
@@ -108,43 +145,6 @@ struct lov_stripe_md *lsm_alloc_plain(u16 stripe_count)return NULL ; } -void lsm_free_plain (struct lov_stripe_md *lsm) -{ -__u16 stripe_count = lsm->lsm_stripe_count; -int i; - -for (i =0 ; i < stripe_count; i++) -kmem_cache_free (lov_oinfo_slab, lsm->lsm_oinfo[i]); -kvfree (lsm); -} - -/* -* Find minimum stripe maxbytes value. For inactive or -* reconnecting targets use LUSTRE_EXT3_STRIPE_MAXBYTES. -*/ -static loff_t lov_tgt_maxbytes (struct lov_tgt_desc *tgt) -{ -loff_t maxbytes =LUSTRE_EXT3_STRIPE_MAXBYTES ; -struct obd_import *imp; - -if (!tgt->ltd_active) -return maxbytes; - - imp = tgt->ltd_obd->u.cli.cl_import; -if (!imp) -return maxbytes; - -spin_lock (&imp->imp_lock); -if (imp->imp_state ==LUSTRE_IMP_FULL && - (imp->imp_connect_data.ocd_connect_flags &OBD_CONNECT_MAXBYTES ) && - imp->imp_connect_data.ocd_maxbytes >0 ) - maxbytes = imp->imp_connect_data.ocd_maxbytes; - -spin_unlock (&imp->imp_lock); - -return maxbytes; -} - static int lsm_unpackmd_common(struct lov_obd *lov, struct lov_stripe_md *lsm, struct lov_mds_md *lmm,
@@ -320,6 +320,19 @@ static int lsm_unpackmd_v3(struct lov_obd *lov, struct lov_stripe_md *lsm, .lsm_unpackmd = lsm_unpackmd_v3, }; +const struct lsm_operations *lsm_op_find (int magic) +{ +switch (magic) { +case LOV_MAGIC_V1 : +return &lsm_v1_ops; +case LOV_MAGIC_V3 : +return &lsm_v3_ops; +default : +CERROR ("unrecognized lsm_magic %08x\n" , magic); +return NULL ; + } +} +void dump_lsm (unsigned int level,const struct lov_stripe_md *lsm) { CDEBUG(level, "lsm %p, objid " DOSTID ", maxbytes %#llx, magic 0x%08X, stripe_size %u, stripe_count %u, refc: %d, layout_gen %u, pool [" LOV_POOLNAMEF "]\n",
drivers/staging/lustre/lustre/lov/lov_internal.h +1 -15
@@ -92,21 +92,7 @@ struct lsm_operations { struct lov_mds_md *lmm); }; -extern const struct lsm_operations lsm_v1_ops; -extern const struct lsm_operations lsm_v3_ops; - -static inline const struct lsm_operations *lsm_op_find (int magic) -{ -switch (magic) { -case LOV_MAGIC_V1 : -return &lsm_v1_ops; -case LOV_MAGIC_V3 : -return &lsm_v3_ops; -default : -CERROR ("unrecognized lsm_magic %08x\n" , magic); -return NULL ; - } -} +const struct lsm_operations *lsm_op_find (int magic);/* lov_do_div64(a, b) returns a % b, and a = a / b. * The 32-bit code is LOV-specific due to knowing about stripe limits in
Signature · 1 line
1.8.3.1
PATCH 2/28 lustre: lov: move code for PFL work
Quoted 4 lines · James Simmons
From: Bobi Jam <[email protected]>
Move
lov_tgt_maxbytes()andlsm_free_plain()toward the top oflov_ea.cfor upcoming PFL work.
No mention of the lsm_op_find() move??
That function is still in lov_internal.h in OpenSFS lustre !!
Thanks,
NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20181218/65953ebc/attachment.sig>
PATCH 2/28 lustre: lov: move code for PFL work
Quoted 10 lines · James Simmons
Quoted 5 lines
From: Bobi Jam <[email protected]>
Move
lov_tgt_maxbytes()andlsm_free_plain()toward the top oflov_ea.cfor upcoming PFL work.No mention of the
lsm_op_find()move??
That function is still inlov_internal.hin OpenSFS lustre !!
Added details of that move. This is one of those changes that Greg asked for in the past. He didn't like extern struct .... in a header file along with a inline function to handle those external structs.
PATCH 3/28 lustre: lov: merge lov_mds_md_v3 and lov_mds_md_v1 handling
In reply to James SimmonsFrom: Bobi Jam <[email protected]>
Several of the struct lsm_operations functions for both v1 and v3 are nearly identical. Let merge them together.
WC-bug-id: https://jira.whamcloud.com/browse/LU-8998
Reviewed-on: https://review.whamcloud.com/24849
WC-bug-id: https://jira.whamcloud.com/browse/LU-9315
Reviewed-on: https://review.whamcloud.com/26503
--- drivers/staging/lustre/lustre/lov/lov_ea.c | 66 ++++++++++++------------ drivers/staging/lustre/lustre/lov/lov_internal.h | 3 +- drivers/staging/lustre/lustre/lov/lov_pack.c | 30 ++++------- 3 files changed, 42 insertions(+), 57 deletions(-)
drivers/staging/lustre/lustre/lov/lov_ea.c +32 -34
@@ -71,8 +71,8 @@ static loff_t lov_tgt_maxbytes(struct lov_tgt_desc *tgt)return maxbytes; } -static int lsm_lmm_verify_common (struct lov_mds_md *lmm,int lmm_bytes, -__u16 stripe_count) +static int lsm_lmm_verify_v1v3 (struct lov_mds_md *lmm,size_t lmm_size, +u16 stripe_count) {if (stripe_count >LOV_V1_INSANE_STRIPE_COUNT ) {CERROR ("bad stripe count %d\n" , stripe_count);
@@ -103,7 +103,7 @@ static int lsm_lmm_verify_common(struct lov_mds_md *lmm, int lmm_bytes,return 0 ; } -void lsm_free_plain (struct lov_stripe_md *lsm) +void lsm_free (struct lov_stripe_md *lsm) {__u16 stripe_count = lsm->lsm_stripe_count;int i;
@@ -145,10 +145,11 @@ struct lov_stripe_md *lsm_alloc_plain(u16 stripe_count)return NULL ; } -static int lsm_unpackmd_common (struct lov_obd *lov, -struct lov_stripe_md *lsm, -struct lov_mds_md *lmm, -struct lov_ost_data_v1 *objects) +static int lsm_unpackmd_v1v3 (struct lov_obd *lov, +struct lov_stripe_md *lsm, +struct lov_mds_md *lmm, +const char *pool_name, +struct lov_ost_data_v1 *objects) {loff_t min_stripe_maxbytes =0 ;unsigned int stripe_count;
@@ -168,6 +169,15 @@ static int lsm_unpackmd_common(struct lov_obd *lov, stripe_count =lsm_is_released (lsm) ?0 : lsm->lsm_stripe_count; +if (pool_name) { +size_t pool_name_len; + + pool_name_len =strlcpy (lsm->lsm_pool_name, pool_name, +sizeof (lsm->lsm_pool_name)); +if (pool_name_len >=sizeof (lsm->lsm_pool_name)) +return -E2BIG ; + } +for (i =0 ; i < stripe_count; i++) { loi = lsm->lsm_oinfo[i];ostid_le_to_cpu (&objects[i].l_ost_oi, &loi->loi_oi);
@@ -248,21 +258,20 @@ static int lsm_lmm_verify_v1(struct lov_mds_md_v1 *lmm, int lmm_bytes,return -EINVAL ; } -return lsm_lmm_verify_common (lmm, lmm_bytes, *stripe_count); +return lsm_lmm_verify_v1v3 (lmm, lmm_bytes, *stripe_count); }static int lsm_unpackmd_v1 (struct lov_obd *lov,struct lov_stripe_md *lsm,struct lov_mds_md_v1 *lmm) { -return lsm_unpackmd_common (lov, lsm, lmm, lmm->lmm_objects); +return lsm_unpackmd_v1v3 (lov, lsm, lmm,NULL , lmm->lmm_objects); } -const struct lsm_operations lsm_v1_ops = { - .lsm_free = lsm_free_plain, - .lsm_stripe_by_index = lsm_stripe_by_index_plain, - .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, - .lsm_lmm_verify = lsm_lmm_verify_v1, - .lsm_unpackmd = lsm_unpackmd_v1, +const static struct lsm_operations lsm_v1_ops = { + .lsm_stripe_by_index = lsm_stripe_by_index_plain, + .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, + .lsm_lmm_verify = lsm_lmm_verify_v1, + .lsm_unpackmd = lsm_unpackmd_v1, }; static int lsm_lmm_verify_v3(struct lov_mds_md *lmmv1, int lmm_bytes,
@@ -289,7 +298,7 @@ static int lsm_lmm_verify_v3(struct lov_mds_md *lmmv1, int lmm_bytes,return -EINVAL ; } -return lsm_lmm_verify_common ((struct lov_mds_md_v1 *)lmm, lmm_bytes, +return lsm_lmm_verify_v1v3 ((struct lov_mds_md_v1 *)lmm, lmm_bytes, *stripe_count); }
@@ -297,27 +306,16 @@ static int lsm_unpackmd_v3(struct lov_obd *lov, struct lov_stripe_md *lsm, struct lov_mds_md *lmm) {struct lov_mds_md_v3 *lmm_v3 = (struct lov_mds_md_v3 *)lmm; -size_t cplen =0 ; -int rc; - rc =lsm_unpackmd_common (lov, lsm, lmm, lmm_v3->lmm_objects); -if (rc) -return rc; - - cplen =strlcpy (lsm->lsm_pool_name, lmm_v3->lmm_pool_name, -sizeof (lsm->lsm_pool_name)); -if (cplen >=sizeof (lsm->lsm_pool_name)) -return -E2BIG ; - -return 0 ; +return lsm_unpackmd_v1v3 (lov, lsm, lmm, lmm_v3->lmm_pool_name, + lmm_v3->lmm_objects); } -const struct lsm_operations lsm_v3_ops = { - .lsm_free = lsm_free_plain, - .lsm_stripe_by_index = lsm_stripe_by_index_plain, - .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, - .lsm_lmm_verify = lsm_lmm_verify_v3, - .lsm_unpackmd = lsm_unpackmd_v3, +const static struct lsm_operations lsm_v3_ops = { + .lsm_stripe_by_index = lsm_stripe_by_index_plain, + .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, + .lsm_lmm_verify = lsm_lmm_verify_v3, + .lsm_unpackmd = lsm_unpackmd_v3, };const struct lsm_operations *lsm_op_find (int magic)
drivers/staging/lustre/lustre/lov/lov_internal.h +1 -2
@@ -81,7 +81,6 @@ static inline bool lsm_has_objects(struct lov_stripe_md *lsm) }struct lsm_operations { -void (*lsm_free)(struct lov_stripe_md *);void (*lsm_stripe_by_index)(struct lov_stripe_md *,int *,loff_t *,loff_t *); void (*lsm_stripe_by_offset)(struct lov_stripe_md *, int *, loff_t *,
@@ -93,6 +92,7 @@ struct lsm_operations { };const struct lsm_operations *lsm_op_find (int magic); +void lsm_free (struct lov_stripe_md *lsm);/* lov_do_div64(a, b) returns a % b, and a = a / b. * The 32-bit code is LOV-specific due to knowing about stripe limits in
@@ -224,7 +224,6 @@ struct lov_stripe_md *lov_unpackmd(struct lov_obd *lov, struct lov_mds_md *lmm,/* lov_ea.c */ struct lov_stripe_md *lsm_alloc_plain (u16 stripe_count); -void lsm_free_plain (struct lov_stripe_md *lsm);void dump_lsm (unsigned int level,const struct lov_stripe_md *lsm);/* lproc_lov.c */
drivers/staging/lustre/lustre/lov/lov_pack.c +9 -21
@@ -181,22 +181,6 @@ __u16 lov_get_stripecnt(struct lov_obd *lov, __u32 magic, __u16 stripe_count)return stripe_count; } -static int lov_verify_lmm (void *lmm,int lmm_bytes,__u16 *stripe_count) -{ -int rc; - -if (!lsm_op_find (le32_to_cpu (*(__u32 *)lmm))) { -CERROR ("bad disk LOV MAGIC: 0x%08X; dumping LMM (size=%d):\n" , -le32_to_cpu (*(__u32 *)lmm), lmm_bytes); -CERROR ("%*phN\n" , lmm_bytes, lmm); -return -EINVAL ; - } - rc =lsm_op_find (le32_to_cpu (*(__u32 *)lmm))->lsm_lmm_verify (lmm, - lmm_bytes, - stripe_count); -return rc; -} -static struct lov_stripe_md *lov_lsm_alloc (u16 stripe_count,u32 pattern,u32 magic) {
@@ -237,7 +221,7 @@ int lov_free_memmd(struct lov_stripe_md **lsmp)LASSERT (atomic_read (&lsm->lsm_refc) >0 ); refc =atomic_dec_return (&lsm->lsm_refc);if (refc ==0 ) -lsm_op_find (lsm->lsm_magic)->lsm_free (lsm); +lsm_free (lsm);return refc; }
@@ -248,25 +232,29 @@ int lov_free_memmd(struct lov_stripe_md **lsmp)struct lov_stripe_md *lov_unpackmd (struct lov_obd *lov,struct lov_mds_md *lmm,size_t lmm_size) { +const struct lsm_operations *op;struct lov_stripe_md *lsm;u16 stripe_count;u32 pattern;u32 magic;int rc; - rc =lov_verify_lmm (lmm, lmm_size, &stripe_count); + magic =le32_to_cpu (lmm->lmm_magic); + op =lsm_op_find (magic); +if (!op) +return ERR_PTR (-EINVAL ); + + rc = op->lsm_lmm_verify (lmm, lmm_size, &stripe_count);if (rc)return ERR_PTR (rc); - magic =le32_to_cpu (lmm->lmm_magic); pattern =le32_to_cpu (lmm->lmm_pattern); lsm =lov_lsm_alloc (stripe_count, pattern, magic);if (IS_ERR (lsm))return lsm; -LASSERT (lsm_op_find (magic)); - rc =lsm_op_find (magic)->lsm_unpackmd (lov, lsm, lmm); + rc = op->lsm_unpackmd (lov, lsm, lmm);if (rc) {lov_free_memmd (&lsm);return ERR_PTR (rc);
Signature · 1 line
1.8.3.1
PATCH 3/28 lustre: lov: merge lov_mds_md_v3 and lov_mds_md_v1 handling
Quoted 4 lines · James Simmons
From: Bobi Jam <[email protected]>
Several of the struct
lsm_operationsfunctions for both v1 and v3 are nearly identical. Let merge them together.
Let's
drivers/staging/lustre/lustre/lov/lov_ea.c static int lsm_lmm_verify_v1(struct lov_mds_md_v1 *lmm, int lmm_bytes, · line 274
Quoted 12 lines
drivers/staging/lustre/lustre/lov/lov_ea.c +5
-6-const struct lsm_operations lsm_v1_ops = { - .lsm_free = lsm_free_plain, - .lsm_stripe_by_index = lsm_stripe_by_index_plain, - .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, - .lsm_lmm_verify = lsm_lmm_verify_v1, - .lsm_unpackmd = lsm_unpackmd_v1, +const static struct lsm_operations lsm_v1_ops = { + .lsm_stripe_by_index = lsm_stripe_by_index_plain, + .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, + .lsm_lmm_verify = lsm_lmm_verify_v1, + .lsm_unpackmd = lsm_unpackmd_v1,
I *SO* wish you would stop combining white-spaces fixes with other changes in the same patch!!!
The above hunk should just add the 'static' and remove the 'lsm_free'. The rest is just noise and makes it harder to review the patch.
Thanks,
NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20181218/87d9594b/attachment.sig>
PATCH 3/28 lustre: lov: merge lov_mds_md_v3 and lov_mds_md_v1 handling
Just throwing this in, I agree with Neil very strongly here. I?ve seen some patches recently with ~20 lines of change and 200 lines of whitespace.
________________________________
From: lustre-devel <[email protected]> on behalf of NeilBrown <[email protected]>
Sent: Monday, December 17, 2018 6:09:57 PM
To: James Simmons; Andreas Dilger; Oleg Drokin; Bobi Jam; Jinshan Xiong
Cc: Lustre Development List
Subject: Re: [lustre-devel] [PATCH 03/28] lustre: lov: merge lov_mds_md_v3 and lov_mds_md_v1 handling
Quoted 4 lines · James Simmons
From: Bobi Jam <[email protected]>
Several of the struct
lsm_operationsfunctions for both v1 and v3 are nearly identical. Let merge them together.
Let's
drivers/staging/lustre/lustre/lov/lov_ea.c static int lsm_lmm_verify_v1(struct lov_mds_md_v1 *lmm, int lmm_bytes, · line 274
Quoted 12 lines
drivers/staging/lustre/lustre/lov/lov_ea.c +5
-6-const struct lsm_operations lsm_v1_ops = { - .lsm_free = lsm_free_plain, - .lsm_stripe_by_index = lsm_stripe_by_index_plain, - .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, - .lsm_lmm_verify = lsm_lmm_verify_v1, - .lsm_unpackmd = lsm_unpackmd_v1, +const static struct lsm_operations lsm_v1_ops = { + .lsm_stripe_by_index = lsm_stripe_by_index_plain, + .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, + .lsm_lmm_verify = lsm_lmm_verify_v1, + .lsm_unpackmd = lsm_unpackmd_v1,
I *SO* wish you would stop combining white-spaces fixes with other changes in the same patch!!!
The above hunk should just add the 'static' and remove the 'lsm_free'. The rest is just noise and makes it harder to review the patch.
Thanks,
NeilBrown
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20181218/62ee40ec/attachment-0001.html>
PATCH 3/28 lustre: lov: merge lov_mds_md_v3 and lov_mds_md_v1 handling
Quoted 3 lines
Just throwing this in, I agree with Neil very strongly here.? I?ve seen some patches recently with ~20 lines of change and 200 lines of whitespace.
Must be a patch for OpenSFS branch :-) Is this one of Arshad Hussain patches? Those are meant to be cleanup / checkpatch fixing patches. Thankfully Arshad is doing this work. For a long time the policy for the OpenSFS branch was to do all the clean ups with real fixes. The reasoning was not to lose "real" fixes in the noise of cleanups. With Arshad that seems to be changing now.
Quoted 37 lines
___________________________________________________________________________________________________________________________________________
From: lustre-devel <[email protected]> on behalf of NeilBrown <[email protected]>
Sent: Monday, December 17, 2018 6:09:57 PM
To: James Simmons; Andreas Dilger; Oleg Drokin; Bobi Jam; Jinshan Xiong
Cc: Lustre Development List
Subject: Re: [lustre-devel] [PATCH 03/28] lustre: lov: mergelov_mds_md_v3andlov_mds_md_v1handling ?Quoted 4 lines · James Simmons
From: Bobi Jam <[email protected]>
Several of the struct
lsm_operationsfunctions for both v1 and v3 are nearly identical. Let merge them together.??????????????????????? Let's
??????????????????????Review
Quoted 12 lines
?
(quoted diff) +5
-6-const struct lsm_operations lsm_v1_ops = { -???? .lsm_free?????????? = lsm_free_plain, -???? .lsm_stripe_by_index??? = lsm_stripe_by_index_plain, -???? .lsm_stripe_by_offset?? = lsm_stripe_by_offset_plain, -???? .lsm_lmm_verify? = lsm_lmm_verify_v1, -???? .lsm_unpackmd????? = lsm_unpackmd_v1, +const static struct lsm_operations lsm_v1_ops = { +???? .lsm_stripe_by_index??? = lsm_stripe_by_index_plain, +???? .lsm_stripe_by_offset?? = lsm_stripe_by_offset_plain, +???? .lsm_lmm_verify???????? = lsm_lmm_verify_v1, +???? .lsm_unpackmd?????????? = lsm_unpackmd_v1,I *SO* wish you would stop combining white-spaces fixes with other changes in the same patch!!!
The above hunk should just add the 'static' and remove the 'lsm_free'. The rest is just noise and makes it harder to review the patch.Thanks,
NeilBrown
PATCH 3/28 lustre: lov: merge lov_mds_md_v3 and lov_mds_md_v1 handling
In reply to NeilBrownQuoted 17 lines
drivers/staging/lustre/lustre/lov/lov_ea.c static int lsm_lmm_verify_v1(struct lov_mds_md_v1 *lmm, int lmm_bytes, · line 274
Quoted 12 lines
drivers/staging/lustre/lustre/lov/lov_ea.c +5
-6-const struct lsm_operations lsm_v1_ops = { - .lsm_free = lsm_free_plain, - .lsm_stripe_by_index = lsm_stripe_by_index_plain, - .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, - .lsm_lmm_verify = lsm_lmm_verify_v1, - .lsm_unpackmd = lsm_unpackmd_v1, +const static struct lsm_operations lsm_v1_ops = { + .lsm_stripe_by_index = lsm_stripe_by_index_plain, + .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, + .lsm_lmm_verify = lsm_lmm_verify_v1, + .lsm_unpackmd = lsm_unpackmd_v1,I *SO* wish you would stop combining white-spaces fixes with other changes in the same patch!!!
The above hunk should just add the 'static' and remove the 'lsm_free'. The rest is just noise and makes it harder to review the patch.
I can do that for the next update. This is just the early verison. The reason that got in is often I do comparsion of the same files between the LTS and linux client. For me I find that the easiest way to see if I do a porting mistake.
PATCH 4/28 lustre: lov: fold lmm_verify() handling into lmm_unpackmd()
In reply to James SimmonsFrom: Bobi Jam <[email protected]>
The function lov_unpackmd() calls the format specific version of lmm_verify() and uses the returned information to allocate the correct amount for the lsm information. We can fold the lmm_verify() handling into the format specific unpackmd() function. This also enables use to intergate the lsm allocation as well into the unpackmd() function. This also greatly simplifies lov_unpackmd().
WC-bug-id: https://jira.whamcloud.com/browse/LU-8998
Reviewed-on: https://review.whamcloud.com/24849
--- drivers/staging/lustre/lustre/lov/lov_ea.c | 113 ++++++++++++++++++----- drivers/staging/lustre/lustre/lov/lov_internal.h | 11 +-- drivers/staging/lustre/lustre/lov/lov_pack.c | 59 +----------- 3 files changed, 99 insertions(+), 84 deletions(-)
drivers/staging/lustre/lustre/lov/lov_ea.c +91 -22
@@ -145,6 +145,37 @@ struct lov_stripe_md *lsm_alloc_plain(u16 stripe_count)return NULL ; } +static struct lov_stripe_md *lov_lsm_alloc (u16 stripe_count,u32 pattern, +u32 magic) +{ +struct lov_stripe_md *lsm; +unsigned int i; + +CDEBUG (D_INFO ,"alloc lsm, stripe_count %u\n" , stripe_count); + + lsm =lsm_alloc_plain (stripe_count); +if (!lsm) { +CERROR ("cannot allocate LSM stripe_count %u\n" , stripe_count); +return ERR_PTR (-ENOMEM ); + } + +atomic_set (&lsm->lsm_refc,1 ); +spin_lock_init (&lsm->lsm_lock); + lsm->lsm_magic = magic; + lsm->lsm_stripe_count = stripe_count; + lsm->lsm_maxbytes =LUSTRE_EXT3_STRIPE_MAXBYTES * stripe_count; + lsm->lsm_pattern = pattern; + lsm->lsm_pool_name[0 ] ='\0' ; + lsm->lsm_layout_gen =0 ; +if (stripe_count >0 ) + lsm->lsm_oinfo[0 ]->loi_ost_idx = ~0 ; + +for (i =0 ; i < stripe_count; i++) +loi_init (lsm->lsm_oinfo[i]); + +return lsm; +} + static int lsm_unpackmd_v1v3(struct lov_obd *lov, struct lov_stripe_md *lsm, struct lov_mds_md *lmm,
@@ -238,12 +269,12 @@ static int lsm_unpackmd_v1v3(struct lov_obd *lov, *swidth = (u64 )lsm->lsm_stripe_size * lsm->lsm_stripe_count; } -static int lsm_lmm_verify_v1 (struct lov_mds_md_v1 *lmm,int lmm_bytes, +static int lsm_lmm_verify_v1 (struct lov_mds_md_v1 *lmm,size_t lmm_bytes,__u16 *stripe_count) {if (lmm_bytes <sizeof (*lmm)) { -CERROR ("lov_mds_md_v1 too small: %d, need at least %d\n" , - lmm_bytes, (int )sizeof (*lmm)); +CERROR ("lov_mds_md_v1 too small: %zu, need@least %zu\n" , + lmm_bytes,sizeof (*lmm));return -EINVAL ; }
@@ -252,7 +283,7 @@ static int lsm_lmm_verify_v1(struct lov_mds_md_v1 *lmm, int lmm_bytes, *stripe_count =0 ;if (lmm_bytes <lov_mds_md_size (*stripe_count,LOV_MAGIC_V1 )) { -CERROR ("LOV EA V1 too small: %d, need %d\n" , +CERROR ("LOV EA V1 too small: %zu, need %d\n" , lmm_bytes,lov_mds_md_size (*stripe_count,LOV_MAGIC_V1 ));lov_dump_lmm_common (D_WARNING , lmm);return -EINVAL ;
@@ -261,29 +292,47 @@ static int lsm_lmm_verify_v1(struct lov_mds_md_v1 *lmm, int lmm_bytes,return lsm_lmm_verify_v1v3 (lmm, lmm_bytes, *stripe_count); } -static int lsm_unpackmd_v1 (struct lov_obd *lov,struct lov_stripe_md *lsm, -struct lov_mds_md_v1 *lmm) +static struct lov_stripe_md * +lsm_unpackmd_v1 (struct lov_obd *lov,void *buf,size_t buf_size) { -return lsm_unpackmd_v1v3 (lov, lsm, lmm,NULL , lmm->lmm_objects); +struct lov_mds_md_v1 *lmm = buf; +u32 magic =le32_to_cpu (lmm->lmm_magic); +struct lov_stripe_md *lsm; +u16 stripe_count; +u32 pattern; +int rc; + + rc =lsm_lmm_verify_v1 (lmm, buf_size, &stripe_count); +if (rc) +return ERR_PTR (rc); + + pattern =le32_to_cpu (lmm->lmm_pattern); + + lsm =lov_lsm_alloc (stripe_count, pattern, magic); +if (IS_ERR (lsm)) +return lsm; + + rc =lsm_unpackmd_v1v3 (lov, lsm, lmm,NULL , lmm->lmm_objects); +if (rc) { +lov_free_memmd (&lsm); + lsm =ERR_PTR (rc); + } + +return lsm; }const static struct lsm_operations lsm_v1_ops = { .lsm_stripe_by_index = lsm_stripe_by_index_plain, .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, - .lsm_lmm_verify = lsm_lmm_verify_v1, .lsm_unpackmd = lsm_unpackmd_v1, }; -static int lsm_lmm_verify_v3 (struct lov_mds_md *lmmv1,int lmm_bytes, +static int lsm_lmm_verify_v3 (struct lov_mds_md_v3 *lmm,size_t lmm_bytes,__u16 *stripe_count) { -struct lov_mds_md_v3 *lmm; - - lmm = (struct lov_mds_md_v3 *)lmmv1; -if (lmm_bytes <sizeof (*lmm)) { -CERROR ("lov_mds_md_v3 too small: %d, need at least %d\n" , - lmm_bytes, (int )sizeof (*lmm)); +CERROR ("lov_mds_md_v3 too small: %zu, need@least %zu\n" , + lmm_bytes,sizeof (*lmm));return -EINVAL ; }
@@ -292,7 +341,7 @@ static int lsm_lmm_verify_v3(struct lov_mds_md *lmmv1, int lmm_bytes, *stripe_count =0 ;if (lmm_bytes <lov_mds_md_size (*stripe_count,LOV_MAGIC_V3 )) { -CERROR ("LOV EA V3 too small: %d, need %d\n" , +CERROR ("LOV EA V3 too small: %zu, need %d\n" , lmm_bytes,lov_mds_md_size (*stripe_count,LOV_MAGIC_V3 ));lov_dump_lmm_common (D_WARNING , lmm);return -EINVAL ;
@@ -302,19 +351,39 @@ static int lsm_lmm_verify_v3(struct lov_mds_md *lmmv1, int lmm_bytes, *stripe_count); } -static int lsm_unpackmd_v3 (struct lov_obd *lov,struct lov_stripe_md *lsm, -struct lov_mds_md *lmm) +static struct lov_stripe_md * +lsm_unpackmd_v3 (struct lov_obd *lov,void *buf,size_t buf_size) { -struct lov_mds_md_v3 *lmm_v3 = (struct lov_mds_md_v3 *)lmm; +struct lov_mds_md_v3 *lmm = buf; +u32 magic =le32_to_cpu (lmm->lmm_magic); +struct lov_stripe_md *lsm; +u16 stripe_count; +u32 pattern; +int rc; + + rc =lsm_lmm_verify_v3 (lmm, buf_size, &stripe_count); +if (rc) +return ERR_PTR (rc); + + pattern =le32_to_cpu (lmm->lmm_pattern); -return lsm_unpackmd_v1v3 (lov, lsm, lmm, lmm_v3->lmm_pool_name, - lmm_v3->lmm_objects); + lsm =lov_lsm_alloc (stripe_count, pattern, magic); +if (IS_ERR (lsm)) +return lsm; + + rc =lsm_unpackmd_v1v3 (lov, lsm, (struct lov_mds_md_v1 *)lmm, + lmm->lmm_pool_name, lmm->lmm_objects); +if (rc) { +lov_free_memmd (&lsm); + lsm =ERR_PTR (rc); + } + +return lsm; }const static struct lsm_operations lsm_v3_ops = { .lsm_stripe_by_index = lsm_stripe_by_index_plain, .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, - .lsm_lmm_verify = lsm_lmm_verify_v3, .lsm_unpackmd = lsm_unpackmd_v3, };
drivers/staging/lustre/lustre/lov/lov_internal.h +4 -7
@@ -85,10 +85,8 @@ struct lsm_operations { loff_t *);void (*lsm_stripe_by_offset)(struct lov_stripe_md *,int *,loff_t *,loff_t *); -int (*lsm_lmm_verify)(struct lov_mds_md *lmm,int lmm_bytes, -u16 *stripe_count); -int (*lsm_unpackmd)(struct lov_obd *lov,struct lov_stripe_md *lsm, -struct lov_mds_md *lmm); +struct lov_stripe_md *(*lsm_unpackmd)(struct lov_obd *obd,void *buf, +size_t buf_len); };const struct lsm_operations *lsm_op_find (int magic);
@@ -214,8 +212,8 @@ int lov_del_target(struct obd_device *obd, __u32 index,/* lov_pack.c */ ssize_t lov_lsm_pack (const struct lov_stripe_md *lsm,void *buf,size_t buf_size); -struct lov_stripe_md *lov_unpackmd (struct lov_obd *lov,struct lov_mds_md *lmm, -size_t lmm_size); +struct lov_stripe_md *lov_unpackmd (struct lov_obd *lov,void *buf, +size_t buf_size);int lov_free_memmd (struct lov_stripe_md **lsmp);void lov_dump_lmm_v1 (int level,struct lov_mds_md_v1 *lmm);
@@ -223,7 +221,6 @@ struct lov_stripe_md *lov_unpackmd(struct lov_obd *lov, struct lov_mds_md *lmm,void lov_dump_lmm_common (int level,void *lmmp);/* lov_ea.c */ -struct lov_stripe_md *lsm_alloc_plain (u16 stripe_count);void dump_lsm (unsigned int level,const struct lov_stripe_md *lsm);/* lproc_lov.c */
drivers/staging/lustre/lustre/lov/lov_pack.c +4 -55
79 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 5/28 lustre: lov: create struct lov_stripe_md_entry
In reply to James SimmonsFrom: Bobi Jam <[email protected]>
Create a new struct lov_stripe_md_entry that will be shared with older striping methods and the new PFL handling. Rearrange the code to handle this new data structure.
WC-bug-id: https://jira.whamcloud.com/browse/LU-8998
Reviewed-on: https://review.whamcloud.com/24849
--- drivers/staging/lustre/lustre/include/obd.h | 4 - drivers/staging/lustre/lustre/lov/lov_ea.c | 338 ++++++++++------------- drivers/staging/lustre/lustre/lov/lov_internal.h | 35 ++- drivers/staging/lustre/lustre/lov/lov_io.c | 17 +- drivers/staging/lustre/lustre/lov/lov_merge.c | 4 +- drivers/staging/lustre/lustre/lov/lov_object.c | 80 +++--- drivers/staging/lustre/lustre/lov/lov_offset.c | 8 +- drivers/staging/lustre/lustre/lov/lov_pack.c | 32 +-- 8 files changed, 245 insertions(+), 273 deletions(-)
drivers/staging/lustre/lustre/include/obd.h +0 -4
@@ -75,10 +75,6 @@ static inline void loi_kms_set(struct lov_oinfo *oinfo, __u64 kms) oinfo->loi_kms_valid =1 ; } -static inline void loi_init (struct lov_oinfo *loi) -{ -} -struct lov_stripe_md ;struct obd_info ;
drivers/staging/lustre/lustre/lov/lov_ea.c +149 -189
428 lines not on this page · raw message
drivers/staging/lustre/lustre/lov/lov_internal.h +17 -18
@@ -44,6 +44,18 @@*/ #define LUSTRE_EXT3_STRIPE_MAXBYTES 0x1fffffff000ULL +struct lov_stripe_md_entry { +struct lu_extent lsme_extent; +u32 lsme_id; +u32 lsme_magic; +u32 lsme_pattern; +u32 lsme_stripe_size; +u16 lsme_stripe_count; +u16 lsme_layout_gen; +char lsme_pool_name[LOV_MAXPOOLNAME +1 ]; +struct lov_oinfo *lsme_oinfo[]; +}; +struct lov_stripe_md {atomic_t lsm_refc;spinlock_t lsm_lock;
@@ -56,28 +68,15 @@ struct lov_stripe_md {loff_t lsm_maxbytes;struct ost_id lsm_oi;u32 lsm_magic; -u32 lsm_stripe_size; -u32 lsm_pattern;/* RAID0, RAID1, released, ... */ -u16 lsm_stripe_count; -u16 lsm_layout_gen; -char lsm_pool_name[LOV_MAXPOOLNAME +1 ]; -struct lov_oinfo *lsm_oinfo[0 ]; +u32 lsm_layout_gen; +u32 lsm_entry_count; +bool lsm_is_released; +struct lov_stripe_md_entry *lsm_entries[]; }; -static inline bool lsm_is_released (struct lov_stripe_md *lsm) -{ -return !!(lsm->lsm_pattern &LOV_PATTERN_F_RELEASED ); -} -static inline bool lsm_has_objects (struct lov_stripe_md *lsm) { -if (!lsm) -return false; - -if (lsm_is_released (lsm)) -return false; - -return true; +return lsm && !lsm->lsm_is_released; }struct lsm_operations {
drivers/staging/lustre/lustre/lov/lov_io.c +8 -9
@@ -251,10 +251,9 @@ static int lov_io_subio_init(const struct lu_env *env, struct lov_io *lio,* Need to be optimized, we can't afford to allocate a piece of memory * when writing a page. -jay */ - lio->lis_subs = -kvzalloc (lsm->lsm_stripe_count * + lio->lis_subs =kcalloc (lsm->lsm_entries[0 ]->lsme_stripe_count,sizeof (lio->lis_subs[0 ]), -GFP_NOFS ); +GFP_KERNEL );if (lio->lis_subs) { lio->lis_nr_subios = lio->lis_stripe_count; lio->lis_single_subio_index =-1 ;
@@ -272,7 +271,7 @@ static int lov_io_slice_init(struct lov_io *lio, struct lov_object *obj, io->ci_result =0 ; lio->lis_object = obj; - lio->lis_stripe_count = obj->lo_lsm->lsm_stripe_count; + lio->lis_stripe_count = obj->lo_lsm->lsm_entries[0 ]->lsme_stripe_count;switch (io->ci_type) {case CIT_READ :
@@ -287,7 +286,7 @@ static int lov_io_slice_init(struct lov_io *lio, struct lov_object *obj,* If there is LOV EA hole, then we may cannot locate * the current file-tail exactly. */ -if (unlikely (obj->lo_lsm->lsm_pattern & +if (unlikely (obj->lo_lsm->lsm_entries[0 ]->lsme_pattern &LOV_PATTERN_F_HOLE ))return -EIO ;
@@ -419,9 +418,9 @@ static int lov_io_rw_iter_init(const struct lu_env *env,struct lov_io *lio =cl2lov_io (env, ios);struct cl_io *io = ios->cis_io;struct lov_stripe_md *lsm = lio->lis_object->lo_lsm; -__u64 start = io->u.ci_rw.crw_pos; +unsigned long ssize = lsm->lsm_entries[0 ]->lsme_stripe_size; +u64 start = io->u.ci_rw.crw_pos;loff_t next; -unsigned long ssize = lsm->lsm_stripe_size;LASSERT (io->ci_type ==CIT_READ || io->ci_type ==CIT_WRITE );
@@ -596,11 +595,11 @@ static int lov_io_read_ahead(const struct lu_env *env,if (ra_end !=CL_PAGE_EOF ) ra_end =lov_stripe_pgoff (loo->lo_lsm, ra_end, stripe); - pps = loo->lo_lsm->lsm_stripe_size >>PAGE_SHIFT ; + pps = loo->lo_lsm->lsm_entries[0 ]->lsme_stripe_size >>PAGE_SHIFT ;CDEBUG (D_READA ,DFID " max_index = %lu, pps = %u, stripe_size = %u, stripe no = %u, start index = %lu\n" ,PFID (lu_object_fid (lov2lu (loo))), ra_end, pps, - loo->lo_lsm->lsm_stripe_size, stripe, start); + loo->lo_lsm->lsm_entries[0 ]->lsme_stripe_size, stripe, start);/* never exceed the end of the stripe */ ra->cra_end =min_t (pgoff_t, ra_end, start + pps - start % pps -1 );
drivers/staging/lustre/lustre/lov/lov_merge.c +2 -2
@@ -59,8 +59,8 @@ int lov_merge_lvb_kms(struct lov_stripe_md *lsm,CDEBUG (D_INODE ,"MDT ID " DOSTID " initial value: s=%llu m=%llu a=%llu c=%llu b=%llu\n" ,POSTID (&lsm->lsm_oi), lvb->lvb_size, lvb->lvb_mtime, lvb->lvb_atime, lvb->lvb_ctime, lvb->lvb_blocks); -for (i =0 ; i < lsm->lsm_stripe_count; i++) { -struct lov_oinfo *loi = lsm->lsm_oinfo[i]; +for (i =0 ; i < lsm->lsm_entries[0 ]->lsme_stripe_count; i++) { +struct lov_oinfo *loi = lsm->lsm_entries[0 ]->lsme_oinfo[i];u64 lov_size, tmpsize;if (OST_LVB_IS_ERR (loi->loi_lvb.lvb_blocks)) {
drivers/staging/lustre/lustre/lov/lov_object.c +49 -31
219 lines not on this page · raw message
drivers/staging/lustre/lustre/lov/lov_offset.c +4 -4
@@ -40,7 +40,7 @@/* compute object size given "stripeno" and the ost size */ u64 lov_stripe_size (struct lov_stripe_md *lsm,u64 ost_size,int stripeno) { -unsigned long ssize = lsm->lsm_stripe_size; +unsigned long ssize = lsm->lsm_entries[0 ]->lsme_stripe_size;unsigned long stripe_size;u64 swidth;u64 lov_size;
@@ -125,7 +125,7 @@ pgoff_t lov_stripe_pgoff(struct lov_stripe_md *lsm, pgoff_t stripe_index,int lov_stripe_offset (struct lov_stripe_md *lsm,u64 lov_off,int stripeno,u64 *obdoff) { -unsigned long ssize = lsm->lsm_stripe_size; +unsigned long ssize = lsm->lsm_entries[0 ]->lsme_stripe_size;u64 stripe_off, this_stripe, swidth;int magic = lsm->lsm_magic;int ret =0 ;
@@ -180,7 +180,7 @@ int lov_stripe_offset(struct lov_stripe_md *lsm, u64 lov_off,u64 lov_size_to_stripe (struct lov_stripe_md *lsm,u64 file_size,int stripeno) { -unsigned long ssize = lsm->lsm_stripe_size; +unsigned long ssize = lsm->lsm_entries[0 ]->lsme_stripe_size;u64 stripe_off, this_stripe, swidth;int magic = lsm->lsm_magic;
@@ -254,7 +254,7 @@ int lov_stripe_intersects(struct lov_stripe_md *lsm, int stripeno,/* compute which stripe number "lov_off" will be written into */ int lov_stripe_number (struct lov_stripe_md *lsm,u64 lov_off) { -unsigned long ssize = lsm->lsm_stripe_size; +unsigned long ssize = lsm->lsm_entries[0 ]->lsme_stripe_size;u64 stripe_off, swidth;int magic = lsm->lsm_magic;
drivers/staging/lustre/lustre/lov/lov_pack.c +16 -16
@@ -116,7 +116,8 @@ ssize_t lov_lsm_pack(const struct lov_stripe_md *lsm, void *buf,size_t lmm_size;unsigned int i; - lmm_size =lov_mds_md_size (lsm->lsm_stripe_count, lsm->lsm_magic); + lmm_size =lov_mds_md_size (lsm->lsm_entries[0 ]->lsme_stripe_count, + lsm->lsm_magic);if (!buf_size)return lmm_size;
@@ -129,23 +130,24 @@ ssize_t lov_lsm_pack(const struct lov_stripe_md *lsm, void *buf,*/ lmmv1->lmm_magic =cpu_to_le32 (lsm->lsm_magic);lmm_oi_cpu_to_le (&lmmv1->lmm_oi, &lsm->lsm_oi); - lmmv1->lmm_stripe_size =cpu_to_le32 (lsm->lsm_stripe_size); - lmmv1->lmm_stripe_count =cpu_to_le16 (lsm->lsm_stripe_count); - lmmv1->lmm_pattern =cpu_to_le32 (lsm->lsm_pattern); + lmmv1->lmm_stripe_size =cpu_to_le32 (lsm->lsm_entries[0 ]->lsme_stripe_size); + lmmv1->lmm_stripe_count =cpu_to_le16 (lsm->lsm_entries[0 ]->lsme_stripe_count); + lmmv1->lmm_pattern =cpu_to_le32 (lsm->lsm_entries[0 ]->lsme_pattern); lmmv1->lmm_layout_gen =cpu_to_le16 (lsm->lsm_layout_gen);if (lsm->lsm_magic ==LOV_MAGIC_V3 ) { -BUILD_BUG_ON (sizeof (lsm->lsm_pool_name) != -sizeof (lmmv3->lmm_pool_name)); -strlcpy (lmmv3->lmm_pool_name, lsm->lsm_pool_name, +BUILD_BUG_ON (sizeof (lsm->lsm_entries[0 ]->lsme_pool_name) != +sizeof (lmmv3->lmm_pool_name)); +strlcpy (lmmv3->lmm_pool_name, + lsm->lsm_entries[0 ]->lsme_pool_name,sizeof (lmmv3->lmm_pool_name)); lmm_objects = lmmv3->lmm_objects; }else { lmm_objects = lmmv1->lmm_objects; } -for (i =0 ; i < lsm->lsm_stripe_count; i++) { -struct lov_oinfo *loi = lsm->lsm_oinfo[i]; +for (i =0 ; i < lsm->lsm_entries[0 ]->lsme_stripe_count; i++) { +struct lov_oinfo *loi = lsm->lsm_entries[0 ]->lsme_oinfo[i];ostid_cpu_to_le (&loi->loi_oi, &lmm_objects[i].l_ost_oi); lmm_objects[i].l_ost_gen =cpu_to_le32 (loi->loi_ost_gen);
@@ -240,8 +242,8 @@ int lov_getstripe(struct lov_object *obj, struct lov_stripe_md *lsm, goto out; } -if (!lsm_is_released (lsm)) - stripe_count = lsm->lsm_stripe_count; +if (!lsm->lsm_is_released) + stripe_count = lsm->lsm_entries[0 ]->lsme_stripe_count;else stripe_count =0 ;
@@ -260,18 +262,16 @@ int lov_getstripe(struct lov_object *obj, struct lov_stripe_md *lsm, goto out; } -if (lum.lmm_stripe_count && - (lum.lmm_stripe_count < lsm->lsm_stripe_count)) { +if (lum.lmm_stripe_count && lum.lmm_stripe_count < stripe_count) {/* Return right size of stripe to user */ lum.lmm_stripe_count = stripe_count; rc =copy_to_user (lump, &lum, lum_size); rc = -EOVERFLOW ; goto out; } - lmmk_size =lov_mds_md_size (stripe_count, lsm->lsm_magic); - - lmmk =kvzalloc (lmmk_size,GFP_NOFS ); + lmmk_size =lov_mds_md_size (stripe_count, lsm->lsm_magic); + lmmk =kvzalloc (lmmk_size,GFP_KERNEL );if (!lmmk) { rc = -ENOMEM ; goto out;
Signature · 1 line
1.8.3.1
PATCH 6/28 lustre: lov: add composite layout unpacking
In reply to James SimmonsFrom: Bobi Jam <[email protected]>
Update struct lov_stripe_md to accommodate composite layouts. Add methods to unpack composite layouts.
WC-bug-id: https://jira.whamcloud.com/browse/LU-8998
Reviewed-on: https://review.whamcloud.com/24849
WC-bug-id: https://jira.whamcloud.com/browse/LU-9315
Reviewed-on: https://review.whamcloud.com/26503
--- drivers/staging/lustre/lustre/lov/lov_ea.c | 175 ++++++++++++++++++++++++++- drivers/staging/lustre/lustre/lov/lov_pack.c | 3 + 2 files changed, 175 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/lov/lov_ea.c +172 -3
@@ -38,12 +38,21 @@#define DEBUG_SUBSYSTEM S_LOV#include <asm/div64.h> +#include <linux/sort.h> #include <obd_class.h> #include <uapi/linux/lustre/lustre_idl.h> +#include <uapi/linux/lustre/lustre_user.h> #include "lov_internal.h" +static inline void lu_extent_le_to_cpu (struct lu_extent *dst, +const struct lu_extent *src) +{ + dst->e_start =le64_to_cpu (src->e_start); + dst->e_end =le64_to_cpu (src->e_end); +} +/* * Find minimum stripe maxbytes value. For inactive or * reconnecting targets use LUSTRE_EXT3_STRIPE_MAXBYTES.
@@ -347,17 +356,177 @@ void lsm_free(struct lov_stripe_md *lsm) .lsm_unpackmd = lsm_unpackmd_v3, }; +static int lsm_verify_comp_md_v1 (struct lov_comp_md_v1 *lcm, +size_t lcm_buf_size) +{ +unsigned int entry_count; +size_t lcm_size; +unsigned int i; + + lcm_size =le32_to_cpu (lcm->lcm_size); +if (lcm_buf_size < lcm_size) { +CERROR ("bad LCM buffer size %zu, expected %zu\n" , + lcm_buf_size, lcm_size); +return -EINVAL ; + } + + entry_count =le16_to_cpu (lcm->lcm_entry_count); +for (i =0 ; i < entry_count; i++) { +struct lov_comp_md_entry_v1 *lcme = &lcm->lcm_entries[i]; +size_t blob_offset; +size_t blob_size; + + blob_offset =le32_to_cpu (lcme->lcme_offset); + blob_size =le32_to_cpu (lcme->lcme_size); + +if (lcm_size < blob_offset || lcm_size < blob_size || + lcm_size < blob_offset + blob_size) { +CERROR ("LCM entry %u has invalid blob: LCM size = %zu, offset = %zu, size = %zu\n" , +le32_to_cpu (lcme->lcme_id), lcm_size, + blob_offset, blob_size); +return -EINVAL ; + } + } + +return 0 ; +} + +static struct lov_stripe_md_entry * +lsme_unpack_comp (struct lov_obd *lov,struct lov_mds_md *lmm, +size_t lmm_buf_size,loff_t *maxbytes) +{ +unsigned int stripe_count; +unsigned int magic; + + stripe_count =le16_to_cpu (lmm->lmm_stripe_count); +if (stripe_count ==0 ) +return ERR_PTR (-EINVAL ); + + magic =le32_to_cpu (lmm->lmm_magic); +if (magic !=LOV_MAGIC_V1 && magic !=LOV_MAGIC_V3 ) +return ERR_PTR (-EINVAL ); + +if (lmm_buf_size <lov_mds_md_size (stripe_count, magic)) +return ERR_PTR (-EINVAL ); + +if (magic ==LOV_MAGIC_V1 ) { +return lsme_unpack (lov, lmm, lmm_buf_size,NULL , + lmm->lmm_objects, maxbytes); + }else { +struct lov_mds_md_v3 *lmm3 = (struct lov_mds_md_v3 *)lmm; + +return lsme_unpack (lov, lmm, lmm_buf_size, lmm3->lmm_pool_name, + lmm3->lmm_objects, maxbytes); + } +} + +static struct lov_stripe_md * +lsm_unpackmd_comp_md_v1 (struct lov_obd *lov,void *buf,size_t buf_size) +{ +struct lov_comp_md_v1 *lcm = buf; +struct lov_stripe_md *lsm; +unsigned int entry_count =0 ; +loff_t maxbytes; +size_t lsm_size; +unsigned int i; +int rc; + + rc =lsm_verify_comp_md_v1 (buf, buf_size); +if (rc <0 ) +return ERR_PTR (rc); + + entry_count =le16_to_cpu (lcm->lcm_entry_count); + + lsm_size = offsetof(typeof(*lsm), lsm_entries[entry_count]); + lsm =kzalloc (lsm_size,GFP_KERNEL ); +if (!lsm) +return ERR_PTR (-ENOMEM ); + +atomic_set (&lsm->lsm_refc,1 ); +spin_lock_init (&lsm->lsm_lock); + lsm->lsm_magic =le32_to_cpu (lcm->lcm_magic); + lsm->lsm_layout_gen =le32_to_cpu (lcm->lcm_layout_gen); + lsm->lsm_entry_count = entry_count; + lsm->lsm_is_released = true; + lsm->lsm_maxbytes =LLONG_MIN ; + +for (i =0 ; i < entry_count; i++) { +struct lov_comp_md_entry_v1 *lcme = &lcm->lcm_entries[i]; +struct lov_stripe_md_entry *lsme; +size_t blob_offset; +size_t blob_size; +void *blob; + + blob_offset =le32_to_cpu (lcme->lcme_offset); + blob_size =le32_to_cpu (lcme->lcme_size); + blob = (char *)lcm + blob_offset; + + lsme =lsme_unpack_comp (lov, blob, blob_size, + (i == entry_count -1 ) ? &maxbytes : +NULL ); +if (IS_ERR (lsme)) { + rc =PTR_ERR (lsme); + goto out_lsm; + } + +if (!(lsme->lsme_pattern &LOV_PATTERN_F_RELEASED )) + lsm->lsm_is_released = false; + + lsm->lsm_entries[i] = lsme; + lsme->lsme_id =le32_to_cpu (lcme->lcme_id); +lu_extent_le_to_cpu (&lsme->lsme_extent, &lcme->lcme_extent); + +if (i == entry_count -1 ) { + lsm->lsm_maxbytes = (loff_t )lsme->lsme_extent.e_start + + maxbytes; +/* the last component hasn't been defined, or +* lsm_maxbytes overflowed. +*/ +if (lsme->lsme_extent.e_end !=LUSTRE_EOF || + lsm->lsm_maxbytes < + (loff_t )lsme->lsme_extent.e_start) + lsm->lsm_maxbytes =MAX_LFS_FILESIZE ; + } + } + +return lsm; + +out_lsm: +for (i =0 ; i < entry_count; i++) +if (lsm->lsm_entries[i]) +lsme_free (lsm->lsm_entries[i]); + +kfree (lsm); + +return ERR_PTR (rc); +} + +const static struct lsm_operations lsm_comp_md_v1_ops = { + .lsm_stripe_by_index = lsm_stripe_by_index_plain, + .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, + .lsm_unpackmd = lsm_unpackmd_comp_md_v1, +}; +const struct lsm_operations *lsm_op_find (int magic) { +const struct lsm_operations *lsm =NULL ; +switch (magic) {case LOV_MAGIC_V1 : -return &lsm_v1_ops; + lsm = &lsm_v1_ops; +break ;case LOV_MAGIC_V3 : -return &lsm_v3_ops; + lsm = &lsm_v3_ops; +break ; +case LOV_MAGIC_COMP_V1 : + lsm = &lsm_comp_md_v1_ops; +break ;default :CERROR ("unrecognized lsm_magic %08x\n" , magic); -return NULL ; +break ; } + +return lsm; }void dump_lsm (unsigned int level,const struct lov_stripe_md *lsm)
drivers/staging/lustre/lustre/lov/lov_pack.c +3 -0
@@ -206,6 +206,9 @@ struct lov_stripe_md *lov_unpackmd(struct lov_obd *lov, void *buf,const struct lsm_operations *op;u32 magic; +if (buf_size <sizeof (magic)) +return ERR_PTR (-EINVAL ); + magic =le32_to_cpu (*(u32 *)buf); op =lsm_op_find (magic);if (!op)
Signature · 1 line
1.8.3.1
PATCH 7/28 lustre: lov: embedded raid0 in struct lov_layout_composite
In reply to James SimmonsFrom: Bobi Jam <[email protected]>
Create bare bones struct lov_layout_composite that Make client layer support composite layout.
Plain layout will be stored in LOV layer as a composite layout containing a single component.
WC-bug-id: https://jira.whamcloud.com/browse/LU-8998
Reviewed-on: https://review.whamcloud.com/24850
--- .../staging/lustre/lustre/lov/lov_cl_internal.h | 78 ++++++++++++---------- drivers/staging/lustre/lustre/lov/lov_object.c | 8 +-- drivers/staging/lustre/lustre/lov/lovsub_object.c | 8 +-- 3 files changed, 50 insertions(+), 44 deletions(-)
drivers/staging/lustre/lustre/lov/lov_cl_internal.h +42 -36
@@ -129,6 +129,42 @@ static inline char *llt2str(enum lov_layout_type llt)return "" ; } +struct lov_layout_raid0 { +unsigned int lo_nr; +/** +* When this is true, lov_object::lo_attr contains +* valid up to date attributes for a top-level +* object. This field is reset to 0 when attributes of +* any sub-object change. +*/ +int lo_attr_valid; +/** +* Array of sub-objects. Allocated when top-object is +* created (lov_init_raid0()). +* +* Top-object is a strict master of its sub-objects: +* it is created before them, and outlives its +* children (this later is necessary so that basic +* functions like cl_object_top() always +* work). Top-object keeps a reference on every +* sub-object. +* +* When top-object is destroyed (lov_delete_raid0()) +* it releases its reference to a sub-object and waits +* until the latter is finally destroyed. +*/ +struct lovsub_object **lo_sub; +/** +* protect lo_sub +*/ +spinlock_t lo_sub_lock; +/** +* Cached object attribute, built from sub-object +* attributes. +*/ +struct cl_attr lo_attr; +}; +/** * lov-specific file state. *
@@ -178,45 +214,15 @@ struct lov_object {struct lov_stripe_md *lo_lsm;union lov_layout_state { -struct lov_layout_raid0 { -unsigned int lo_nr; -/** -* When this is true, lov_object::lo_attr contains -* valid up to date attributes for a top-level -* object. This field is reset to 0 when attributes of -* any sub-object change. -*/ -int lo_attr_valid; -/** -* Array of sub-objects. Allocated when top-object is -* created (lov_init_raid0()). -* -* Top-object is a strict master of its sub-objects: -* it is created before them, and outlives its -* children (this later is necessary so that basic -* functions like cl_object_top() always -* work). Top-object keeps a reference on every -* sub-object. -* -* When top-object is destroyed (lov_delete_raid0()) -* it releases its reference to a sub-object and waits -* until the latter is finally destroyed. -*/ -struct lovsub_object **lo_sub; -/** -* protect lo_sub -*/ -spinlock_t lo_sub_lock; -/** -* Cached object attribute, built from sub-object -* attributes. -*/ -struct cl_attr lo_attr; - } raid0;struct lov_layout_state_empty { } empty;struct lov_layout_state_released { } released; +struct lov_layout_composite { +struct lov_layout_entry { +struct lov_layout_raid0 lle_raid0; + } lo_entries; + } composite; } u;/** * Thread that acquired lov_object::lo_type_guard in an exclusive
@@ -627,7 +633,7 @@ static inline struct lov_layout_raid0 *lov_r0(struct lov_object *lov)LASSERT (lov->lo_type ==LLT_RAID0 );LASSERT (lov->lo_lsm->lsm_magic ==LOV_MAGIC || lov->lo_lsm->lsm_magic ==LOV_MAGIC_V3 ); -return &lov->u.raid0; +return &lov->u.composite.lo_entries.lle_raid0; }/* lov_pack.c */
drivers/staging/lustre/lustre/lov/lov_object.c +4 -4
@@ -228,7 +228,7 @@ static int lov_init_raid0(const struct lu_env *env, struct lov_device *dev,struct lov_thread_info *lti =lov_env_info (env);struct cl_object_conf *subconf = <i->lti_stripe_conf;struct lu_fid *ofid = <i->lti_fid; -struct lov_layout_raid0 *r0 = &state->raid0; +struct lov_layout_raid0 *r0 = &state->composite.lo_entries.lle_raid0;if (lsm->lsm_magic !=LOV_MAGIC_V1 && lsm->lsm_magic !=LOV_MAGIC_V3 ) {dump_lsm (D_ERROR , lsm);
@@ -375,7 +375,7 @@ static void lov_subobject_kill(const struct lu_env *env, struct lov_object *lov,wait_queue_head_t *wq;wait_queue_entry_t *waiter; - r0 = &lov->u.raid0; + r0 = &lov->u.composite.lo_entries.lle_raid0;LASSERT (r0->lo_sub[idx] == los); sub =lovsub2cl (los);
@@ -418,7 +418,7 @@ static void lov_subobject_kill(const struct lu_env *env, struct lov_object *lov,static int lov_delete_raid0 (const struct lu_env *env,struct lov_object *lov,union lov_layout_state *state) { -struct lov_layout_raid0 *r0 = &state->raid0; +struct lov_layout_raid0 *r0 = &state->composite.lo_entries.lle_raid0;struct lov_stripe_md *lsm = lov->lo_lsm;int i;
@@ -451,7 +451,7 @@ static void lov_fini_empty(const struct lu_env *env, struct lov_object *lov,static void lov_fini_raid0 (const struct lu_env *env,struct lov_object *lov,union lov_layout_state *state) { -struct lov_layout_raid0 *r0 = &state->raid0; +struct lov_layout_raid0 *r0 = &state->composite.lo_entries.lle_raid0;if (r0->lo_sub) {kvfree (r0->lo_sub);
drivers/staging/lustre/lustre/lov/lovsub_object.c +4 -4
@@ -80,10 +80,10 @@ static void lovsub_object_free(const struct lu_env *env, struct lu_object *obj)*/ if (lov) {LASSERT (lov->lo_type ==LLT_RAID0 ); -LASSERT (lov->u.raid0.lo_sub[los->lso_index] == los); -spin_lock (&lov->u.raid0.lo_sub_lock); - lov->u.raid0.lo_sub[los->lso_index] =NULL ; -spin_unlock (&lov->u.raid0.lo_sub_lock); +LASSERT (lov->u.composite.lo_entries.lle_raid0.lo_sub[los->lso_index] == los); +spin_lock (&lov->u.composite.lo_entries.lle_raid0.lo_sub_lock); + lov->u.composite.lo_entries.lle_raid0.lo_sub[los->lso_index] =NULL ; +spin_unlock (&lov->u.composite.lo_entries.lle_raid0.lo_sub_lock); }lu_object_fini (obj);
Signature · 1 line
1.8.3.1
PATCH 8/28 lustre: lov: migrate lov raid0 to future PFL component handling
In reply to James SimmonsFrom: Bobi Jam <[email protected]>
PFL will change striping from being static to dynamic. The idea of stripe count will change under this case. So rename the fields representing stripe index to component index. The raid0 stripe handing will be replaced with PFL component handling so make the raid0 a subsystem of PFL handling.
WC-bug-id: https://jira.whamcloud.com/browse/LU-8998
Reviewed-on: https://review.whamcloud.com/24850
--- .../staging/lustre/lustre/lov/lov_cl_internal.h | 29 +-- drivers/staging/lustre/lustre/lov/lov_io.c | 41 +++-- drivers/staging/lustre/lustre/lov/lov_lock.c | 8 +- drivers/staging/lustre/lustre/lov/lov_object.c | 196 +++++++++++++-------- drivers/staging/lustre/lustre/lov/lov_page.c | 19 +- drivers/staging/lustre/lustre/lov/lovsub_object.c | 13 +- 6 files changed, 178 insertions(+), 128 deletions(-)
drivers/staging/lustre/lustre/lov/lov_cl_internal.h +15 -14
@@ -108,8 +108,8 @@ struct lov_device {*/ enum lov_layout_type {LLT_EMPTY ,/** empty file without body (mknod + truncate) */ -LLT_RAID0 ,/** striped file */ LLT_RELEASED ,/** file with no objects (data in HSM) */ +LLT_COMP ,/** support composite layout */ LLT_NR };
@@ -118,10 +118,10 @@ static inline char *llt2str(enum lov_layout_type llt)switch (llt) {case LLT_EMPTY :return "EMPTY" ; -case LLT_RAID0 : -return "RAID0" ;case LLT_RELEASED :return "RELEASED" ; +case LLT_COMP : +return "COMPOSITE" ;case LLT_NR :LBUG (); }
@@ -242,7 +242,7 @@ struct lov_lock_sub {*/ unsigned int sub_is_enqueued:1, sub_initialized:1; -int sub_stripe; +int sub_index; };/**
@@ -258,7 +258,8 @@ struct lov_lock {struct lov_page {struct cl_page_slice lps_cl; -unsigned int lps_stripe;/* stripe index */ +/** layout_entry + stripe index, composed using lov_comp_index() */ +unsigned int lps_index; };/*
@@ -309,7 +310,6 @@ struct lov_thread_info {* State that lov_io maintains for every sub-io. */ struct lov_io_sub { -u16 sub_stripe;/** * environment's refcheck. *
@@ -331,6 +331,7 @@ struct lov_io_sub {* sub-io's active for the current IO iteration. */ struct list_head sub_linkage; +u16 sub_subio_index;/** * sub-io for a stripe. Ideally sub-io's can be stopped and resumed * independently, with lov acting as a scheduler to maximize overall
@@ -425,12 +426,12 @@ int lov_io_init(const struct lu_env *env, struct cl_object *obj,int lovsub_lock_init (const struct lu_env *env,struct cl_object *obj,struct cl_lock *lock,const struct cl_io *io); -int lov_lock_init_raid0 (const struct lu_env *env,struct cl_object *obj, -struct cl_lock *lock,const struct cl_io *io); +int lov_lock_init_composite (const struct lu_env *env,struct cl_object *obj, +struct cl_lock *lock,const struct cl_io *io);int lov_lock_init_empty (const struct lu_env *env,struct cl_object *obj,struct cl_lock *lock,const struct cl_io *io); -int lov_io_init_raid0 (const struct lu_env *env,struct cl_object *obj, -struct cl_io *io); +int lov_io_init_composite (const struct lu_env *env,struct cl_object *obj, +struct cl_io *io);int lov_io_init_empty (const struct lu_env *env,struct cl_object *obj,struct cl_io *io); int lov_io_init_released(const struct lu_env *env, struct cl_object *obj,
@@ -445,8 +446,8 @@ int lovsub_page_init(const struct lu_env *env, struct cl_object *ob, struct cl_page *page, pgoff_t index);int lov_page_init_empty (const struct lu_env *env,struct cl_object *obj,struct cl_page *page,pgoff_t index); -int lov_page_init_raid0 (const struct lu_env *env,struct cl_object *obj, -struct cl_page *page,pgoff_t index); +int lov_page_init_composite (const struct lu_env *env,struct cl_object *obj, +struct cl_page *page,pgoff_t index);struct lu_object *lov_object_alloc (const struct lu_env *env,const struct lu_object_header *hdr,struct lu_device *dev);
@@ -455,7 +456,6 @@ struct lu_object *lovsub_object_alloc(const struct lu_env *env, struct lu_device *dev);struct lov_stripe_md *lov_lsm_addref (struct lov_object *lov); -int lov_page_stripe (const struct cl_page *page);#define lov_foreach_target (lov, var) \ for (var = 0; var < lov_targets_nr(lov); ++var)
@@ -630,9 +630,10 @@ static inline struct lov_thread_info *lov_env_info(const struct lu_env *env)static inline struct lov_layout_raid0 *lov_r0 (struct lov_object *lov) { -LASSERT (lov->lo_type ==LLT_RAID0 ); +LASSERT (lov->lo_type ==LLT_COMP );LASSERT (lov->lo_lsm->lsm_magic ==LOV_MAGIC || lov->lo_lsm->lsm_magic ==LOV_MAGIC_V3 ); +return &lov->u.composite.lo_entries.lle_raid0; }
drivers/staging/lustre/lustre/lov/lov_io.c +20 -21
130 lines not on this page · raw message
drivers/staging/lustre/lustre/lov/lov_lock.c +4 -4
@@ -73,7 +73,7 @@ static struct lov_sublock_env *lov_sublock_env_get(const struct lu_env *env, subenv->lse_env = env; subenv->lse_io = io; }else { - sub =lov_sub_get (env, lio, lls->sub_stripe); + sub =lov_sub_get (env, lio, lls->sub_index);if (!IS_ERR (sub)) { subenv->lse_env = sub->sub_env; subenv->lse_io = sub->sub_io;
@@ -167,7 +167,7 @@ static struct lov_lock *lov_lock_sub_init(const struct lu_env *env, descr->cld_mode = lock->cll_descr.cld_mode; descr->cld_gid = lock->cll_descr.cld_gid; descr->cld_enq_flags = lock->cll_descr.cld_enq_flags; - lls->sub_stripe = i; + lls->sub_index = i;/* initialize sub lock */ result =lov_sublock_init (env, lock, lls);
@@ -295,8 +295,8 @@ static int lov_lock_print(const struct lu_env *env, void *cookie, .clo_print = lov_lock_print }; -int lov_lock_init_raid0 (const struct lu_env *env,struct cl_object *obj, -struct cl_lock *lock,const struct cl_io *io) +int lov_lock_init_composite (const struct lu_env *env,struct cl_object *obj, +struct cl_lock *lock,const struct cl_io *io) {struct lov_lock *lck;int result =0 ;
drivers/staging/lustre/lustre/lov/lov_object.c +122 -74
361 lines not on this page · raw message
drivers/staging/lustre/lustre/lov/lov_page.c +9 -10
@@ -50,22 +50,21 @@* Lov page operations. * */ - -static int lov_raid0_page_print (const struct lu_env *env, -const struct cl_page_slice *slice, -void *cookie,lu_printer_t printer) +static int lov_comp_page_print (const struct lu_env *env, +const struct cl_page_slice *slice, +void *cookie,lu_printer_t printer) {struct lov_page *lp =cl2lov_page (slice);return (*printer)(env, cookie,LUSTRE_LOV_NAME "-page@%p, raid0\n" , lp); } -static const struct cl_page_operations lov_raid0_page_ops = { - .cpo_print = lov_raid0_page_print +static const struct cl_page_operations lov_comp_page_ops = { + .cpo_print = lov_comp_page_print }; -int lov_page_init_raid0 (const struct lu_env *env,struct cl_object *obj, -struct cl_page *page,pgoff_t index) +int lov_page_init_composite (const struct lu_env *env,struct cl_object *obj, +struct cl_page *page,pgoff_t index) {struct lov_object *loo =cl2lov (obj);struct lov_layout_raid0 *r0 =lov_r0 (loo);
@@ -85,8 +84,8 @@ int lov_page_init_raid0(const struct lu_env *env, struct cl_object *obj, rc =lov_stripe_offset (loo->lo_lsm, offset, stripe, &suboff);LASSERT (rc ==0 ); - lpg->lps_stripe = stripe; -cl_page_slice_add (page, &lpg->lps_cl, obj, index, &lov_raid0_page_ops); + lpg->lps_index = stripe; +cl_page_slice_add (page, &lpg->lps_cl, obj, index, &lov_comp_page_ops); sub =lov_sub_get (env, lio, stripe);if (IS_ERR (sub))
drivers/staging/lustre/lustre/lov/lovsub_object.c +8 -5
@@ -79,11 +79,14 @@ static void lovsub_object_free(const struct lu_env *env, struct lu_object *obj)* object handling in lu_object_find. */ if (lov) { -LASSERT (lov->lo_type ==LLT_RAID0 ); -LASSERT (lov->u.composite.lo_entries.lle_raid0.lo_sub[los->lso_index] == los); -spin_lock (&lov->u.composite.lo_entries.lle_raid0.lo_sub_lock); - lov->u.composite.lo_entries.lle_raid0.lo_sub[los->lso_index] =NULL ; -spin_unlock (&lov->u.composite.lo_entries.lle_raid0.lo_sub_lock); +int stripe = los->lso_index; +struct lov_layout_raid0 *r0 =lov_r0 (lov); + +LASSERT (lov->lo_type ==LLT_COMP ); +LASSERT (r0->lo_sub[stripe] == los); +spin_lock (&r0->lo_sub_lock); + r0->lo_sub[stripe] =NULL ; +spin_unlock (&r0->lo_sub_lock); }lu_object_fini (obj);
Signature · 1 line
1.8.3.1
PATCH 9/28 lustre: lov: reduce code indentation
In reply to James SimmonsFrom: Bobi Jam <[email protected]>
For lov_init_raid0() we check for the failure of lo_sub and return an error rigth away. This allows us to reduce the code indentation. The same can be done for lov_attr_get_raid0() with the test of r0->lo_attr_valid.
WC-bug-id: https://jira.whamcloud.com/browse/LU-8998
Reviewed-on: https://review.whamcloud.com/24850
--- drivers/staging/lustre/lustre/lov/lov_io.c | 11 +- drivers/staging/lustre/lustre/lov/lov_object.c | 186 ++++++++++++------------- 2 files changed, 96 insertions(+), 101 deletions(-)
drivers/staging/lustre/lustre/lov/lov_io.c +6 -5
@@ -948,12 +948,13 @@ int lov_io_init_composite(const struct lu_env *env, struct cl_object *obj,INIT_LIST_HEAD (&lio->lis_active); io->ci_result =lov_io_slice_init (lio, lov, io); +if (io->ci_result) +return io->ci_result; + + io->ci_result =lov_io_subio_init (env, lio, io);if (io->ci_result ==0 ) { - io->ci_result =lov_io_subio_init (env, lio, io); -if (io->ci_result ==0 ) { -cl_io_slice_add (io, &lio->lis_cl, obj, &lov_io_ops); -atomic_inc (&lov->lo_active_ios); - } +cl_io_slice_add (io, &lio->lis_cl, obj, &lov_io_ops); +atomic_inc (&lov->lo_active_ios); }return io->ci_result; }
drivers/staging/lustre/lustre/lov/lov_object.c +90 -96
222 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 10/28 lustre: lov: change lo_entries to array.
In reply to James SimmonsFrom: Bobi Jam <[email protected]>
Old style striping is equal to a single component. To support PFL we need to change lo_entries to an array.
WC-bug-id: https://jira.whamcloud.com/browse/LU-8998
Reviewed-on: https://review.whamcloud.com/24850
--- .../staging/lustre/lustre/lov/lov_cl_internal.h | 14 +- drivers/staging/lustre/lustre/lov/lov_internal.h | 20 +-- drivers/staging/lustre/lustre/lov/lov_io.c | 27 ++-- drivers/staging/lustre/lustre/lov/lov_lock.c | 13 +- drivers/staging/lustre/lustre/lov/lov_merge.c | 6 +- drivers/staging/lustre/lustre/lov/lov_object.c | 149 ++++++++++++--------- drivers/staging/lustre/lustre/lov/lov_offset.c | 30 +++-- drivers/staging/lustre/lustre/lov/lov_page.c | 11 +- drivers/staging/lustre/lustre/lov/lovsub_object.c | 5 +- 9 files changed, 158 insertions(+), 117 deletions(-)
drivers/staging/lustre/lustre/lov/lov_cl_internal.h +9 -5
@@ -219,9 +219,13 @@ struct lov_object {struct lov_layout_state_released { } released;struct lov_layout_composite { +/** +* Current valid entry count of lo_entries. +*/ +unsigned int lo_entry_count;struct lov_layout_entry {struct lov_layout_raid0 lle_raid0; - } lo_entries; + } *lo_entries; } composite; } u;/**
@@ -628,13 +632,13 @@ static inline struct lov_thread_info *lov_env_info(const struct lu_env *env)return info; } -static inline struct lov_layout_raid0 *lov_r0 (struct lov_object *lov) +static inline struct lov_layout_raid0 *lov_r0 (struct lov_object *lov,int i) {LASSERT (lov->lo_type ==LLT_COMP ); -LASSERT (lov->lo_lsm->lsm_magic ==LOV_MAGIC || - lov->lo_lsm->lsm_magic ==LOV_MAGIC_V3 ); +LASSERTF (i < lov->u.composite.lo_entry_count, +"entry %d entry_count %d" , i, lov->u.composite.lo_entry_count); -return &lov->u.composite.lo_entries.lle_raid0; +return &lov->u.composite.lo_entries[i].lle_raid0; }/* lov_pack.c */
drivers/staging/lustre/lustre/lov/lov_internal.h +11 -9
@@ -169,20 +169,22 @@ struct lov_request_set { (char *)((lv)->lov_tgts[index]->ltd_uuid.uuid) /* lov_merge.c */ -int lov_merge_lvb_kms (struct lov_stripe_md *lsm, +int lov_merge_lvb_kms (struct lov_stripe_md *lsm,int index,struct ost_lvb *lvb,__u64 *kms_place);/* lov_offset.c */ -u64 lov_stripe_size (struct lov_stripe_md *lsm,u64 ost_size,int stripeno); -int lov_stripe_offset (struct lov_stripe_md *lsm,u64 lov_off, -int stripeno,u64 *u64); -u64 lov_size_to_stripe (struct lov_stripe_md *lsm,u64 file_size,int stripeno); -int lov_stripe_intersects (struct lov_stripe_md *lsm,int stripeno, +u64 lov_stripe_size (struct lov_stripe_md *lsm,int index,u64 ost_size, +int stripeno); +int lov_stripe_offset (struct lov_stripe_md *lsm,int index,u64 lov_off, +int stripeno,u64 *obd_off); +u64 lov_size_to_stripe (struct lov_stripe_md *lsm,int index,u64 file_size, +int stripeno); +int lov_stripe_intersects (struct lov_stripe_md *lsm,int index,int stripeno,u64 start,u64 end,u64 *obd_start,u64 *obd_end); -int lov_stripe_number (struct lov_stripe_md *lsm,u64 lov_off); -pgoff_t lov_stripe_pgoff (struct lov_stripe_md *lsm,pgoff_t stripe_index, -int stripe); +int lov_stripe_number (struct lov_stripe_md *lsm,int index,u64 lov_off); +pgoff_t lov_stripe_pgoff (struct lov_stripe_md *lsm,int index, +pgoff_t stripe_index,int stripe);/* lov_request.c */ int lov_prep_statfs_set(struct obd_device *obd, struct obd_info *oinfo,
drivers/staging/lustre/lustre/lov/lov_io.c +16 -11
@@ -85,7 +85,7 @@ static void lov_io_sub_inherit(struct cl_io *io, struct lov_io *lio,if (cl_io_is_trunc (io)) {loff_t new_size = parent->u.ci_setattr.sa_attr.lvb_size; - new_size =lov_size_to_stripe (lsm, new_size, stripe); + new_size =lov_size_to_stripe (lsm,0 , new_size, stripe); io->u.ci_setattr.sa_attr.lvb_size = new_size; }break ;
@@ -101,7 +101,7 @@ static void lov_io_sub_inherit(struct cl_io *io, struct lov_io *lio,loff_t off =cl_offset (obj, parent->u.ci_fault.ft_index); io->u.ci_fault = parent->u.ci_fault; - off =lov_size_to_stripe (lsm, off, stripe); + off =lov_size_to_stripe (lsm,0 , off, stripe); io->u.ci_fault.ft_index =cl_index (obj, off);break ; }
@@ -144,13 +144,14 @@ static int lov_io_sub_init(const struct lu_env *env, struct lov_io *lio,struct cl_object *sub_obj;struct cl_io *io = lio->lis_cl.cis_io;int stripe = sub->sub_subio_index; +int index =0 ;int rc;LASSERT (!sub->sub_io);LASSERT (!sub->sub_env);LASSERT (sub->sub_subio_index < lio->lis_stripe_count); -if (unlikely (!lov_r0 (lov)->lo_sub[stripe])) +if (unlikely (!lov_r0 (lov, index)->lo_sub[stripe]))return -EIO ; sub->sub_io_initialized =0 ;
@@ -179,7 +180,7 @@ static int lov_io_sub_init(const struct lu_env *env, struct lov_io *lio, } } - sub_obj =lovsub2cl (lov_r0 (lov)->lo_sub[stripe]); + sub_obj =lovsub2cl (lov_r0 (lov, index)->lo_sub[stripe]); sub_io = sub->sub_io; sub_io->ci_obj = sub_obj;
@@ -375,14 +376,15 @@ static int lov_io_iter_init(const struct lu_env *env,u64 end;int stripe;int rc =0 ; +int index =0 ; endpos =lov_offset_mod (lio->lis_endpos,-1 );for (stripe =0 ; stripe < lio->lis_stripe_count; stripe++) { -if (!lov_stripe_intersects (lsm, stripe, lio->lis_pos, +if (!lov_stripe_intersects (lsm, index, stripe, lio->lis_pos, endpos, &start, &end))continue ; -if (unlikely (!lov_r0 (lio->lis_object)->lo_sub[stripe])) { +if (unlikely (!lov_r0 (lio->lis_object, index)->lo_sub[stripe])) {if (ios->cis_io->ci_type ==CIT_READ || ios->cis_io->ci_type ==CIT_WRITE || ios->cis_io->ci_type ==CIT_FAULT )
@@ -555,15 +557,18 @@ static int lov_io_read_ahead(const struct lu_env *env,struct lov_io *lio =cl2lov_io (env, ios);struct lov_object *loo = lio->lis_object;struct cl_object *obj =lov2cl (loo); -struct lov_layout_raid0 *r0 =lov_r0 (loo); +struct lov_layout_raid0 *r0;unsigned int pps;/* pages per stripe */ struct lov_io_sub *sub;pgoff_t ra_end; -loff_t suboff; +u64 suboff;int stripe; +int index =0 ;int rc; - stripe =lov_stripe_number (loo->lo_lsm,cl_offset (obj, start)); + stripe =lov_stripe_number (loo->lo_lsm, index,cl_offset (obj, start)); + + r0 =lov_r0 (loo, index);if (unlikely (!r0->lo_sub[stripe]))return -EIO ;
@@ -571,7 +576,7 @@ static int lov_io_read_ahead(const struct lu_env *env,if (IS_ERR (sub))return PTR_ERR (sub); -lov_stripe_offset (loo->lo_lsm,cl_offset (obj, start), stripe, &suboff); +lov_stripe_offset (loo->lo_lsm, index,cl_offset (obj, start), stripe, &suboff); rc =cl_io_read_ahead (sub->sub_env, sub->sub_io,cl_index (lovsub2cl (r0->lo_sub[stripe]), suboff), ra);
@@ -593,7 +598,7 @@ static int lov_io_read_ahead(const struct lu_env *env,/* cra_end is stripe level, convert it into file level */ ra_end = ra->cra_end;if (ra_end !=CL_PAGE_EOF ) - ra_end =lov_stripe_pgoff (loo->lo_lsm, ra_end, stripe); + ra_end =lov_stripe_pgoff (loo->lo_lsm, index, ra_end, stripe); pps = loo->lo_lsm->lsm_entries[0 ]->lsme_stripe_size >>PAGE_SHIFT ;
drivers/staging/lustre/lustre/lov/lov_lock.c +7 -6
@@ -114,7 +114,11 @@ static struct lov_lock *lov_lock_sub_init(const struct lu_env *env,const struct cl_object *obj, struct cl_lock *lock) { + struct lov_object *loo = cl2lov(obj); +struct lov_layout_raid0 *r0; +struct lov_lock *lovlck;int result =0 ; +int index =0 ;int i;int nr;u64 start;
@@ -122,10 +126,6 @@ static struct lov_lock *lov_lock_sub_init(const struct lu_env *env,u64 file_start;u64 file_end; -struct lov_object *loo =cl2lov (obj); -struct lov_layout_raid0 *r0 =lov_r0 (loo); -struct lov_lock *lovlck; - CDEBUG(D_INODE, "%p: lock/io FID " DFID "/" DFID ", lock/io clobj %p/%p\n", loo, PFID(lu_object_fid(lov2lu(loo))), PFID(lu_object_fid(&obj->co_lu)),
@@ -134,13 +134,14 @@ static struct lov_lock *lov_lock_sub_init(const struct lu_env *env, file_start =cl_offset (lov2cl (loo), lock->cll_descr.cld_start); file_end =cl_offset (lov2cl (loo), lock->cll_descr.cld_end +1 ) -1 ; + r0 =lov_r0 (loo, index);for (i =0 , nr =0 ; i < r0->lo_nr; i++) {/* * XXX for wide striping smarter algorithm is desirable, * breaking out of the loop, early. */ if (likely (r0->lo_sub[i]) &&/* spare layout */ -lov_stripe_intersects (loo->lo_lsm, i, +lov_stripe_intersects (loo->lo_lsm, index, i, file_start, file_end, &start, &end)) nr++; }
@@ -153,7 +154,7 @@ static struct lov_lock *lov_lock_sub_init(const struct lu_env *env, lovlck->lls_nr = nr;for (i =0 , nr =0 ; i < r0->lo_nr; ++i) {if (likely (r0->lo_sub[i]) && -lov_stripe_intersects (loo->lo_lsm, i, +lov_stripe_intersects (loo->lo_lsm, index, i, file_start, file_end, &start, &end)) {struct lov_lock_sub *lls = &lovlck->lls_sub[nr];struct cl_lock_descr *descr;
drivers/staging/lustre/lustre/lov/lov_merge.c +3 -3
@@ -41,7 +41,7 @@* initializes the current atime, mtime, ctime to avoid regressing a more * uptodate time on the local client. */ -int lov_merge_lvb_kms (struct lov_stripe_md *lsm, +int lov_merge_lvb_kms (struct lov_stripe_md *lsm,int index,struct ost_lvb *lvb,__u64 *kms_place) {__u64 size =0 ;
@@ -69,14 +69,14 @@ int lov_merge_lvb_kms(struct lov_stripe_md *lsm, } tmpsize = loi->loi_kms; - lov_size =lov_stripe_size (lsm, tmpsize, i); + lov_size =lov_stripe_size (lsm, index, tmpsize, i);if (lov_size > kms) kms = lov_size;if (loi->loi_lvb.lvb_size > tmpsize) tmpsize = loi->loi_lvb.lvb_size; - lov_size =lov_stripe_size (lsm, tmpsize, i); + lov_size =lov_stripe_size (lsm, index, tmpsize, i);if (lov_size > size) size = lov_size;/* merge blocks, mtime, atime */
drivers/staging/lustre/lustre/lov/lov_object.c +86 -63
307 lines not on this page · raw message
drivers/staging/lustre/lustre/lov/lov_offset.c +16 -14
@@ -38,9 +38,10 @@#include "lov_internal.h" /* compute object size given "stripeno" and the ost size */ -u64 lov_stripe_size (struct lov_stripe_md *lsm,u64 ost_size,int stripeno) +u64 lov_stripe_size (struct lov_stripe_md *lsm,int index,u64 ost_size, +int stripeno) { -unsigned long ssize = lsm->lsm_entries[0 ]->lsme_stripe_size; +unsigned long ssize = lsm->lsm_entries[index]->lsme_stripe_size;unsigned long stripe_size;u64 swidth;u64 lov_size;
@@ -64,12 +65,13 @@ u64 lov_stripe_size(struct lov_stripe_md *lsm, u64 ost_size, int stripeno)/** * Compute file level page index by stripe level page offset */ -pgoff_t lov_stripe_pgoff (struct lov_stripe_md *lsm,pgoff_t stripe_index, -int stripe) +pgoff_t lov_stripe_pgoff (struct lov_stripe_md *lsm,int index, +pgoff_t stripe_index,int stripe) {loff_t offset; - offset =lov_stripe_size (lsm, (stripe_index <<PAGE_SHIFT ) +1 , stripe); + offset =lov_stripe_size (lsm, index, (stripe_index <<PAGE_SHIFT ) +1 , + stripe);return offset >>PAGE_SHIFT ; }
@@ -122,10 +124,10 @@ pgoff_t lov_stripe_pgoff(struct lov_stripe_md *lsm, pgoff_t stripe_index,* falls in the stripe and no shifting was done; > 0 when the offset * was outside the stripe and was pulled back to its final byte. */ -int lov_stripe_offset (struct lov_stripe_md *lsm,u64 lov_off, +int lov_stripe_offset (struct lov_stripe_md *lsm,int index,u64 lov_off,int stripeno,u64 *obdoff) { -unsigned long ssize = lsm->lsm_entries[0 ]->lsme_stripe_size; +unsigned long ssize = lsm->lsm_entries[index]->lsme_stripe_size;u64 stripe_off, this_stripe, swidth;int magic = lsm->lsm_magic;int ret =0 ;
@@ -177,10 +179,10 @@ int lov_stripe_offset(struct lov_stripe_md *lsm, u64 lov_off,* | 0 | 1 | 2 | 0 | 1 | 2 | * --------------------------------------------------------------------- */ -u64 lov_size_to_stripe (struct lov_stripe_md *lsm,u64 file_size, +u64 lov_size_to_stripe (struct lov_stripe_md *lsm,int index,u64 file_size,int stripeno) { -unsigned long ssize = lsm->lsm_entries[0 ]->lsme_stripe_size; +unsigned long ssize = lsm->lsm_entries[index]->lsme_stripe_size;u64 stripe_off, this_stripe, swidth;int magic = lsm->lsm_magic;
@@ -218,13 +220,13 @@ u64 lov_size_to_stripe(struct lov_stripe_md *lsm, u64 file_size,* that is contained within the lov extent. this returns true if the given * stripe does intersect with the lov extent. */ -int lov_stripe_intersects (struct lov_stripe_md *lsm,int stripeno, +int lov_stripe_intersects (struct lov_stripe_md *lsm,int index,int stripeno,u64 start,u64 end,u64 *obd_start,u64 *obd_end) {int start_side, end_side; - start_side =lov_stripe_offset (lsm, start, stripeno, obd_start); - end_side =lov_stripe_offset (lsm, end, stripeno, obd_end); + start_side =lov_stripe_offset (lsm, index, start, stripeno, obd_start); + end_side =lov_stripe_offset (lsm, index, end, stripeno, obd_end);CDEBUG (D_INODE ,"[%llu->%llu] -> [(%d) %llu->%llu (%d)]\n" , start, end, start_side, *obd_start, *obd_end, end_side);
@@ -252,9 +254,9 @@ int lov_stripe_intersects(struct lov_stripe_md *lsm, int stripeno, }/* compute which stripe number "lov_off" will be written into */ -int lov_stripe_number (struct lov_stripe_md *lsm,u64 lov_off) +int lov_stripe_number (struct lov_stripe_md *lsm,int index,u64 lov_off) { -unsigned long ssize = lsm->lsm_entries[0 ]->lsme_stripe_size; +unsigned long ssize = lsm->lsm_entries[index]->lsme_stripe_size;u64 stripe_off, swidth;int magic = lsm->lsm_magic;
drivers/staging/lustre/lustre/lov/lov_page.c +7 -4
@@ -67,21 +67,24 @@ int lov_page_init_composite(const struct lu_env *env, struct cl_object *obj, struct cl_page *page, pgoff_t index) {struct lov_object *loo =cl2lov (obj); -struct lov_layout_raid0 *r0 =lov_r0 (loo);struct lov_io *lio =lov_env_io (env); +struct lov_layout_raid0 *r0;struct cl_object *subobj;struct cl_object *o;struct lov_io_sub *sub;struct lov_page *lpg =cl_object_page_slice (obj, page); -loff_t offset; +u64 offset;u64 suboff;int stripe; +int entry =0 ;int rc; offset =cl_offset (obj, index); - stripe =lov_stripe_number (loo->lo_lsm, offset); + + r0 =lov_r0 (loo, entry); + stripe =lov_stripe_number (loo->lo_lsm, entry, offset);LASSERT (stripe < r0->lo_nr); - rc =lov_stripe_offset (loo->lo_lsm, offset, stripe, &suboff); + rc =lov_stripe_offset (loo->lo_lsm, entry, offset, stripe, &suboff);LASSERT (rc ==0 ); lpg->lps_index = stripe;
drivers/staging/lustre/lustre/lov/lovsub_object.c +3 -2
@@ -79,8 +79,9 @@ static void lovsub_object_free(const struct lu_env *env, struct lu_object *obj)* object handling in lu_object_find. */ if (lov) { +int index =0 ;int stripe = los->lso_index; -struct lov_layout_raid0 *r0 =lov_r0 (lov); +struct lov_layout_raid0 *r0 =lov_r0 (lov, index);LASSERT (lov->lo_type ==LLT_COMP );LASSERT (r0->lo_sub[stripe] == los);
@@ -107,7 +108,7 @@ static int lovsub_attr_update(const struct lu_env *env, struct cl_object *obj, {struct lov_object *lov =cl2lovsub (obj)->lso_super; -lov_r0 (lov)->lo_attr_valid =0 ; +lov_r0 (lov,0 )->lo_attr_valid =0 ;return 0 ; }
Signature · 1 line
1.8.3.1
PATCH 11/28 lustre: lov: move around PFL code and cleanups
In reply to James SimmonsFrom: Bobi Jam <[email protected]>
No code changes expect for sub_subio_index that changed type. Move some code around and some style cleanups. This makes it clear the real code changes from style updates.
WC-bug-id: https://jira.whamcloud.com/browse/LU-8998
Reviewed-on: https://review.whamcloud.com/24850
--- .../staging/lustre/lustre/lov/lov_cl_internal.h | 45 ++--- drivers/staging/lustre/lustre/lov/lov_ea.c | 3 +- drivers/staging/lustre/lustre/lov/lov_io.c | 181 ++++++++++----------- drivers/staging/lustre/lustre/lov/lov_object.c | 25 +-- 4 files changed, 128 insertions(+), 126 deletions(-)
drivers/staging/lustre/lustre/lov/lov_cl_internal.h +23 -22
@@ -315,12 +315,6 @@ struct lov_thread_info {*/ struct lov_io_sub {/** -* environment's refcheck. -* -* \see cl_env_get() -*/ -u16 sub_refcheck; -/** * true, iff cl_io_init() was successfully executed against * lov_io_sub::sub_io. */
@@ -334,18 +328,24 @@ struct lov_io_sub {* Linkage into a list (hanging off lov_io::lis_active) of all * sub-io's active for the current IO iteration. */ -struct list_head sub_linkage; -u16 sub_subio_index; +struct list_head sub_linkage; +unsigned int sub_subio_index;/** * sub-io for a stripe. Ideally sub-io's can be stopped and resumed * independently, with lov acting as a scheduler to maximize overall * throughput. */ -struct cl_io *sub_io; +struct cl_io *sub_io;/** * environment, in which sub-io executes. */ -struct lu_env *sub_env; +struct lu_env *sub_env; +/** +* environment's refcheck. +* +* \see cl_env_get() +*/ +u16 sub_refcheck; };/**
@@ -367,37 +367,38 @@ struct lov_io {* * This is used only for CIT_READ and CIT_WRITE io's. */ -loff_t lis_io_endpos; +loff_t lis_io_endpos;/** * starting position within a file, for the current io loop iteration * (stripe), used by ci_io_loop(). */ -u64 lis_pos; +u64 lis_pos;/** * end position with in a file, for the current stripe io. This is * exclusive (i.e., next offset after last byte affected by io). */ -u64 lis_endpos; - -int lis_stripe_count; -int lis_active_subios; +u64 lis_endpos; +int lis_stripe_count; +int lis_active_subios;/** * the index of ls_single_subio in ls_subios array */ -int lis_single_subio_index; -struct cl_io lis_single_subio; +int lis_single_subio_index; +struct cl_io lis_single_subio; + +/** +* List of active sub-io's. Active sub-io's are under the range +* of [lis_pos, lis_endpos). +*/ +struct list_head lis_active;/** * size of ls_subios array, actually the highest stripe # */ int lis_nr_subios;struct lov_io_sub *lis_subs; -/** -* List of active sub-io's. -*/ -struct list_head lis_active; };struct lov_session {
drivers/staging/lustre/lustre/lov/lov_ea.c +2 -1
@@ -531,7 +531,8 @@ const struct lsm_operations *lsm_op_find(int magic)void dump_lsm (unsigned int level,const struct lov_stripe_md *lsm) { - CDEBUG(level, "lsm %p, objid " DOSTID ", maxbytes %#llx, magic 0x%08X, stripe_size %u, stripe_count %u, refc: %d, layout_gen %u, pool [" LOV_POOLNAMEF "]\n", + CDEBUG(level, + "lsm %p, objid " DOSTID ", maxbytes %#llx, magic 0x%08X, stripe_size %u, stripe_count %u, refc: %d, layout_gen %u, pool [" LOV_POOLNAMEF "]\n", lsm, POSTID(&lsm->lsm_oi), lsm->lsm_maxbytes, lsm->lsm_magic, lsm->lsm_entries[0]->lsme_stripe_size, lsm->lsm_entries[0]->lsme_stripe_count,
drivers/staging/lustre/lustre/lov/lov_io.c +90 -91
223 lines not on this page · raw message
drivers/staging/lustre/lustre/lov/lov_object.c +13 -12
@@ -600,6 +600,7 @@ static int lov_attr_get_raid0(const struct lu_env *env, struct lov_object *lov,return 0 ;memset (lvb,0 ,sizeof (*lvb)); +/* XXX: timestamps can be negative by sanity:test_39m, * how can it be? */
@@ -1200,18 +1201,18 @@ static u64 fiemap_calc_fm_end_offset(struct fiemap *fiemap, }struct fiemap_state { -struct fiemap *fs_fm; -u64 fs_start; -u64 fs_length; -u64 fs_end; -u64 fs_end_offset; -int fs_cur_extent; -int fs_cnt_need; -int fs_start_stripe; -int fs_last_stripe; -bool fs_device_done; -bool fs_finish; -bool fs_enough; +struct fiemap *fs_fm; +u64 fs_start; +u64 fs_length; +u64 fs_end; +u64 fs_end_offset; +int fs_cur_extent; +int fs_cnt_need; +int fs_start_stripe; +int fs_last_stripe; +bool fs_device_done; +bool fs_finish; +bool fs_enough; }; static int fiemap_for_stripe(const struct lu_env *env, struct cl_object *obj,
Signature · 1 line
1.8.3.1
PATCH 12/28 lustre: lov: remove lsm_stripe_by_[index|offset]_plain
In reply to James SimmonsFrom: Bobi Jam <[email protected]>
Since both lsm_stripe_by_index() and lsm_stripe_by_offset() are the same for lsm_operations replace them with a new universal function stripe_width().
WC-bug-id: https://jira.whamcloud.com/browse/LU-8998
Reviewed-on: https://review.whamcloud.com/24850
--- drivers/staging/lustre/lustre/lov/lov_ea.c | 24 ------------------------ drivers/staging/lustre/lustre/lov/lov_internal.h | 4 ---- drivers/staging/lustre/lustre/lov/lov_offset.c | 23 +++++++++++++---------- 3 files changed, 13 insertions(+), 38 deletions(-)
drivers/staging/lustre/lustre/lov/lov_ea.c +0 -24
@@ -309,24 +309,6 @@ void lsm_free(struct lov_stripe_md *lsm)return lsm; } -static void -lsm_stripe_by_index_plain (struct lov_stripe_md *lsm,int *stripeno, -loff_t *lov_off,loff_t *swidth) -{ -if (swidth) - *swidth = (loff_t )lsm->lsm_entries[0 ]->lsme_stripe_size * - lsm->lsm_entries[0 ]->lsme_stripe_count; -} - -static void -lsm_stripe_by_offset_plain (struct lov_stripe_md *lsm,int *stripeno, -loff_t *lov_off,loff_t *swidth) -{ -if (swidth) - *swidth = (loff_t )lsm->lsm_entries[0 ]->lsme_stripe_size * - lsm->lsm_entries[0 ]->lsme_stripe_count; -} -static struct lov_stripe_md *lsm_unpackmd_v1 (struct lov_obd *lov,void *buf,size_t buf_size) {
@@ -336,8 +318,6 @@ void lsm_free(struct lov_stripe_md *lsm) }const static struct lsm_operations lsm_v1_ops = { - .lsm_stripe_by_index = lsm_stripe_by_index_plain, - .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, .lsm_unpackmd = lsm_unpackmd_v1, };
@@ -351,8 +331,6 @@ void lsm_free(struct lov_stripe_md *lsm) }const static struct lsm_operations lsm_v3_ops = { - .lsm_stripe_by_index = lsm_stripe_by_index_plain, - .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, .lsm_unpackmd = lsm_unpackmd_v3, };
@@ -502,8 +480,6 @@ static int lsm_verify_comp_md_v1(struct lov_comp_md_v1 *lcm, }const static struct lsm_operations lsm_comp_md_v1_ops = { - .lsm_stripe_by_index = lsm_stripe_by_index_plain, - .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, .lsm_unpackmd = lsm_unpackmd_comp_md_v1, };
drivers/staging/lustre/lustre/lov/lov_internal.h +0 -4
@@ -80,10 +80,6 @@ static inline bool lsm_has_objects(struct lov_stripe_md *lsm) }struct lsm_operations { -void (*lsm_stripe_by_index)(struct lov_stripe_md *,int *,loff_t *, -loff_t *); -void (*lsm_stripe_by_offset)(struct lov_stripe_md *,int *,loff_t *, -loff_t *);struct lov_stripe_md *(*lsm_unpackmd)(struct lov_obd *obd,void *buf,size_t buf_len); };
drivers/staging/lustre/lustre/lov/lov_offset.c +13 -10
@@ -37,6 +37,15 @@#include "lov_internal.h" +static u64 stripe_width (struct lov_stripe_md *lsm,unsigned int index) +{ +struct lov_stripe_md_entry *entry = lsm->lsm_entries[index]; + +LASSERT (index < lsm->lsm_entry_count); + +return entry->lsme_stripe_size * entry->lsme_stripe_count; +} +/* compute object size given "stripeno" and the ost size */ u64 lov_stripe_size (struct lov_stripe_md *lsm,int index,u64 ost_size,int stripeno)
@@ -45,12 +54,11 @@ u64 lov_stripe_size(struct lov_stripe_md *lsm, int index, u64 ost_size,unsigned long stripe_size;u64 swidth;u64 lov_size; -int magic = lsm->lsm_magic;if (ost_size ==0 )return 0 ; -lsm_op_find (magic)->lsm_stripe_by_index (lsm, &stripeno,NULL , &swidth); + swidth =stripe_width (lsm, index);/* lov_do_div64(a, b) returns a % b, and a = a / b */ stripe_size =lov_do_div64 (ost_size, ssize);
@@ -129,7 +137,6 @@ int lov_stripe_offset(struct lov_stripe_md *lsm, int index, u64 lov_off, {unsigned long ssize = lsm->lsm_entries[index]->lsme_stripe_size;u64 stripe_off, this_stripe, swidth; -int magic = lsm->lsm_magic;int ret =0 ;if (lov_off ==OBD_OBJECT_EOF ) {
@@ -137,8 +144,7 @@ int lov_stripe_offset(struct lov_stripe_md *lsm, int index, u64 lov_off,return 0 ; } -lsm_op_find (magic)->lsm_stripe_by_index (lsm, &stripeno, &lov_off, - &swidth); + swidth =stripe_width (lsm, index);/* lov_do_div64(a, b) returns a % b, and a = a / b */ stripe_off =lov_do_div64 (lov_off, swidth);
@@ -184,13 +190,11 @@ u64 lov_size_to_stripe(struct lov_stripe_md *lsm, int index, u64 file_size, {unsigned long ssize = lsm->lsm_entries[index]->lsme_stripe_size;u64 stripe_off, this_stripe, swidth; -int magic = lsm->lsm_magic;if (file_size ==OBD_OBJECT_EOF )return OBD_OBJECT_EOF ; -lsm_op_find (magic)->lsm_stripe_by_index (lsm, &stripeno, &file_size, - &swidth); + swidth =stripe_width (lsm, index);/* lov_do_div64(a, b) returns a % b, and a = a / b */ stripe_off =lov_do_div64 (file_size, swidth);
@@ -258,9 +262,8 @@ int lov_stripe_number(struct lov_stripe_md *lsm, int index, u64 lov_off) {unsigned long ssize = lsm->lsm_entries[index]->lsme_stripe_size;u64 stripe_off, swidth; -int magic = lsm->lsm_magic; -lsm_op_find (magic)->lsm_stripe_by_offset (lsm,NULL , &lov_off, &swidth); + swidth =stripe_width (lsm, index); stripe_off =lov_do_div64 (lov_off, swidth);
Signature · 1 line
1.8.3.1
PATCH 13/28 lustre: lov: add looping lsm_entry_count times
In reply to James SimmonsFrom: Bobi Jam <[email protected]>
Create lov_for_each_layout_entry() and lov_lse() to handle when lsm_entry_count will be greater than one. Modifiy various code blocks to loop lsm_entry_count times.
WC-bug-id: https://jira.whamcloud.com/browse/LU-8998
Reviewed-on: https://review.whamcloud.com/24850
--- .../staging/lustre/lustre/lov/lov_cl_internal.h | 13 +++ drivers/staging/lustre/lustre/lov/lov_ea.c | 20 +++- drivers/staging/lustre/lustre/lov/lov_io.c | 88 +++++++++------- drivers/staging/lustre/lustre/lov/lov_merge.c | 6 +- drivers/staging/lustre/lustre/lov/lov_object.c | 116 +++++++++++++-------- 5 files changed, 156 insertions(+), 87 deletions(-)
drivers/staging/lustre/lustre/lov/lov_cl_internal.h +13 -0
@@ -235,6 +235,11 @@ struct lov_object {struct task_struct *lo_owner; }; +#define lov_foreach_layout_entry (lov, entry) \ + for (entry = &lov->u.composite.lo_entries[0]; \ + entry < &lov->u.composite.lo_entries[lov->u.composite.lo_entry_count];\ + entry++) +/** * State lov_lock keeps for each sub-lock. */
@@ -642,6 +647,14 @@ static inline struct lov_layout_raid0 *lov_r0(struct lov_object *lov, int i)return &lov->u.composite.lo_entries[i].lle_raid0; } +static inline struct lov_stripe_md_entry *lov_lse (struct lov_object *lov,int i) +{ +LASSERT (lov->lo_lsm); +LASSERT (i < lov->lo_lsm->lsm_entry_count); + +return lov->lo_lsm->lsm_entries[i]; +} +/* lov_pack.c */ int lov_getstripe (struct lov_object *obj,struct lov_stripe_md *lsm,struct lov_user_md __user *lump);
drivers/staging/lustre/lustre/lov/lov_ea.c +15 -5
@@ -507,11 +507,21 @@ const struct lsm_operations *lsm_op_find(int magic)void dump_lsm (unsigned int level,const struct lov_stripe_md *lsm) { +int i; +CDEBUG (level, -"lsm %p, objid " DOSTID ", maxbytes %#llx, magic 0x%08X, stripe_size %u, stripe_count %u, refc: %d, layout_gen %u, pool [" LOV_POOLNAMEF "]\n" , +"lsm %p, objid " DOSTID ", maxbytes %#llx, magic 0x%08X, refc: %d, entry: %u, layout_gen %u\n" , lsm,POSTID (&lsm->lsm_oi), lsm->lsm_maxbytes, lsm->lsm_magic, - lsm->lsm_entries[0 ]->lsme_stripe_size, - lsm->lsm_entries[0 ]->lsme_stripe_count, -atomic_read (&lsm->lsm_refc), lsm->lsm_layout_gen, - lsm->lsm_entries[0 ]->lsme_pool_name); +atomic_read (&lsm->lsm_refc), lsm->lsm_entry_count, + lsm->lsm_layout_gen); + +for (i =0 ; i < lsm->lsm_entry_count; i++) { +struct lov_stripe_md_entry *lse = lsm->lsm_entries[i]; + +CDEBUG (level, +": id: %u, magic 0x%08X, stripe count %u, size %u, layout_gen %u, pool: [" LOV_POOLNAMEF "]\n" , + lse->lsme_id, lse->lsme_magic, + lse->lsme_stripe_count, lse->lsme_stripe_size, + lse->lsme_layout_gen, lse->lsme_pool_name); + } }
drivers/staging/lustre/lustre/lov/lov_io.c +53 -35
124 lines not on this page · raw message
drivers/staging/lustre/lustre/lov/lov_merge.c +4 -2
@@ -44,6 +44,7 @@int lov_merge_lvb_kms (struct lov_stripe_md *lsm,int index,struct ost_lvb *lvb,__u64 *kms_place) { +struct lov_stripe_md_entry *lse = lsm->lsm_entries[index];__u64 size =0 ;__u64 kms =0 ;__u64 blocks =0 ;
@@ -59,8 +60,9 @@ int lov_merge_lvb_kms(struct lov_stripe_md *lsm, int index,CDEBUG (D_INODE ,"MDT ID " DOSTID " initial value: s=%llu m=%llu a=%llu c=%llu b=%llu\n" ,POSTID (&lsm->lsm_oi), lvb->lvb_size, lvb->lvb_mtime, lvb->lvb_atime, lvb->lvb_ctime, lvb->lvb_blocks); -for (i =0 ; i < lsm->lsm_entries[0 ]->lsme_stripe_count; i++) { -struct lov_oinfo *loi = lsm->lsm_entries[0 ]->lsme_oinfo[i]; + +for (i =0 ; i < lse->lsme_stripe_count; i++) { +struct lov_oinfo *loi = lse->lsme_oinfo[i];u64 lov_size, tmpsize;if (OST_LVB_IS_ERR (loi->loi_lvb.lvb_blocks)) {
drivers/staging/lustre/lustre/lov/lov_object.c +71 -45
210 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 14/28 lustre: lov: create lov_comp_* wrappers
In reply to James SimmonsFrom: Bobi Jam <[email protected]>
Add new lov_comp_*() wrappers to get the index, stripe, and entries for PFL components.
WC-bug-id: https://jira.whamcloud.com/browse/LU-8998
Reviewed-on: https://review.whamcloud.com/24850
--- drivers/staging/lustre/lustre/lov/lov_internal.h | 15 ++++++++++++++ drivers/staging/lustre/lustre/lov/lov_io.c | 20 ++++++++++-------- drivers/staging/lustre/lustre/lov/lov_lock.c | 3 ++- drivers/staging/lustre/lustre/lov/lov_object.c | 25 +++++++++++++++-------- drivers/staging/lustre/lustre/lov/lov_page.c | 4 ++-- drivers/staging/lustre/lustre/lov/lovsub_object.c | 9 ++++---- 6 files changed, 52 insertions(+), 24 deletions(-)
drivers/staging/lustre/lustre/lov/lov_internal.h +15 -0
@@ -79,6 +79,21 @@ static inline bool lsm_has_objects(struct lov_stripe_md *lsm)return lsm && !lsm->lsm_is_released; } +static inline unsigned int lov_comp_index (int entry,int stripe) +{ +return stripe; +} + +static inline int lov_comp_stripe (int index) +{ +return index &0xffff ; +} + +static inline int lov_comp_entry (int index) +{ +return 0 ; +} +struct lsm_operations {struct lov_stripe_md *(*lsm_unpackmd)(struct lov_obd *obd,void *buf,size_t buf_len);
drivers/staging/lustre/lustre/lov/lov_io.c +12 -8
@@ -72,8 +72,8 @@ static int lov_io_sub_init(const struct lu_env *env, struct lov_io *lio,struct cl_io *sub_io;struct cl_object *sub_obj;struct cl_io *io = lio->lis_cl.cis_io; -int stripe = sub->sub_subio_index; -int index =0 ; +int index =lov_comp_entry (sub->sub_subio_index); +int stripe =lov_comp_stripe (sub->sub_subio_index);int rc;LASSERT (!sub->sub_io);
@@ -286,11 +286,13 @@ static void lov_io_fini(const struct lu_env *env, const struct cl_io_slice *ios)wake_up_all (&lov->lo_waitq); } -static void lov_io_sub_inherit (struct cl_io *io,struct lov_io *lio, +static void lov_io_sub_inherit (struct lov_io_sub *sub,struct lov_io *lio,int stripe,loff_t start,loff_t end) { +struct cl_io *io = sub->sub_io;struct lov_stripe_md *lsm = lio->lis_object->lo_lsm;struct cl_io *parent = lio->lis_cl.cis_io; +int index =lov_comp_entry (sub->sub_subio_index);switch (io->ci_type) {case CIT_SETATTR : {
@@ -305,7 +307,8 @@ static void lov_io_sub_inherit(struct cl_io *io, struct lov_io *lio,if (cl_io_is_trunc (io)) {loff_t new_size = parent->u.ci_setattr.sa_attr.lvb_size; - new_size =lov_size_to_stripe (lsm,0 , new_size, stripe); + new_size =lov_size_to_stripe (lsm, index, new_size, + stripe); io->u.ci_setattr.sa_attr.lvb_size = new_size; }break ;
@@ -321,7 +324,7 @@ static void lov_io_sub_inherit(struct cl_io *io, struct lov_io *lio,loff_t off =cl_offset (obj, parent->u.ci_fault.ft_index); io->u.ci_fault = parent->u.ci_fault; - off =lov_size_to_stripe (lsm,0 , off, stripe); + off =lov_size_to_stripe (lsm, index, off, stripe); io->u.ci_fault.ft_index =cl_index (obj, off);break ; }
@@ -401,13 +404,14 @@ static int lov_io_iter_init(const struct lu_env *env, } end =lov_offset_mod (end,1 ); - sub =lov_sub_get (env, lio, stripe); + sub =lov_sub_get (env, lio, +lov_comp_index (index -1 , stripe));if (IS_ERR (sub)) { rc =PTR_ERR (sub);break ; } -lov_io_sub_inherit (sub->sub_io, lio, stripe, start, end); +lov_io_sub_inherit (sub, lio, stripe, start, end); rc =cl_io_iter_init (sub->sub_env, sub->sub_io);if (rc) {cl_io_iter_fini (sub->sub_env, sub->sub_io);
@@ -588,7 +592,7 @@ static int lov_io_read_ahead(const struct lu_env *env,if (unlikely (!r0->lo_sub[stripe]))return -EIO ; - sub =lov_sub_get (env, lio, stripe); + sub =lov_sub_get (env, lio,lov_comp_index (index, stripe));if (IS_ERR (sub))return PTR_ERR (sub);
drivers/staging/lustre/lustre/lov/lov_lock.c +2 -1
@@ -168,7 +168,8 @@ static struct lov_lock *lov_lock_sub_init(const struct lu_env *env, descr->cld_mode = lock->cll_descr.cld_mode; descr->cld_gid = lock->cll_descr.cld_gid; descr->cld_enq_flags = lock->cll_descr.cld_enq_flags; - lls->sub_index = i; + + lls->sub_index =lov_comp_index (index, i);/* initialize sub lock */ result =lov_sublock_init (env, lock, lls);
drivers/staging/lustre/lustre/lov/lov_object.c +16 -9
@@ -132,6 +132,8 @@ static int lov_init_sub(const struct lu_env *env, struct lov_object *lov, struct cl_object *subobj, struct lov_layout_raid0 *r0, int idx) { + int stripe = lov_comp_stripe(idx); +int entry =lov_comp_entry (idx);struct cl_object_header *hdr;struct cl_object_header *subhdr;struct cl_object_header *parent;
@@ -154,8 +156,9 @@ static int lov_init_sub(const struct lu_env *env, struct lov_object *lov, subhdr =cl_object_header (subobj); oinfo = lov->lo_lsm->lsm_entries[0 ]->lsme_oinfo[idx]; -CDEBUG (D_INODE ,DFID "@%p[%d] -> " DFID "@%p: ostid: " DOSTID " idx: %d gen: %d\n" , -PFID (&subhdr->coh_lu.loh_fid), subhdr, idx, +CDEBUG (D_INODE , +DFID "@%p[%d:%d] -> " DFID "@%p: ostid: " DOSTID " ost idx: %d gen: %d\n" , +PFID (&subhdr->coh_lu.loh_fid), subhdr, entry, stripe,PFID (&hdr->coh_lu.loh_fid), hdr,POSTID (&oinfo->loi_oi), oinfo->loi_ost_idx, oinfo->loi_ost_gen);
@@ -167,9 +170,9 @@ static int lov_init_sub(const struct lu_env *env, struct lov_object *lov,spin_unlock (&subhdr->coh_attr_guard); subhdr->coh_nesting = hdr->coh_nesting +1 ;lu_object_ref_add (&subobj->co_lu,"lov-parent" , lov); - r0->lo_sub[idx] =cl2lovsub (subobj); - r0->lo_sub[idx]->lso_super = lov; - r0->lo_sub[idx]->lso_index = idx; + r0->lo_sub[stripe] =cl2lovsub (subobj); + r0->lo_sub[stripe]->lso_super = lov; + r0->lo_sub[stripe]->lso_index = idx; result =0 ; }else {struct lu_object *old_obj;
@@ -279,7 +282,8 @@ static int lov_init_raid0(const struct lu_env *env, struct lov_device *dev, goto out; } - result =lov_init_sub (env, lov, stripe, r0, i); + result =lov_init_sub (env, lov, stripe, r0, +lov_comp_index (index, i));if (result == -EAGAIN ) {/* try again */ --i; result =0 ;
@@ -354,14 +358,15 @@ static int lov_init_released(const struct lu_env *env, struct lov_device *dev,static struct cl_object *lov_find_subobj (const struct lu_env *env,struct lov_object *lov,struct lov_stripe_md *lsm, -int stripe_idx) +int index) {struct lov_device *dev =lu2lov_dev (lov2lu (lov)->lo_dev); -struct lov_oinfo *oinfo = lsm->lsm_entries[0 ]->lsme_oinfo[stripe_idx];struct lov_thread_info *lti =lov_env_info (env);struct lu_fid *ofid = <i->lti_fid; +int stripe =lov_comp_stripe (index);struct cl_device *subdev;struct cl_object *result; +struct lov_oinfo *oinfo;int ost_idx;int rc;
@@ -370,6 +375,7 @@ static struct cl_object *lov_find_subobj(const struct lu_env *env, goto out; } + oinfo = lsm->lsm_entries[0 ]->lsme_oinfo[stripe]; ost_idx = oinfo->loi_ost_idx; rc =ostid_to_fid (ofid, &oinfo->loi_oi, ost_idx);if (rc) {
@@ -1291,7 +1297,8 @@ static int fiemap_for_stripe(const struct lu_env *env, struct cl_object *obj, len_mapped_single_call =0 ;/* find lobsub object */ - subobj =lov_find_subobj (env,cl2lov (obj), lsm, stripeno); + subobj =lov_find_subobj (env,cl2lov (obj), lsm, +lov_comp_index (index, stripeno));if (IS_ERR (subobj))return PTR_ERR (subobj);/* If the output buffer is very large and the objects have many
drivers/staging/lustre/lustre/lov/lov_page.c +2 -2
@@ -87,10 +87,10 @@ int lov_page_init_composite(const struct lu_env *env, struct cl_object *obj, rc =lov_stripe_offset (loo->lo_lsm, entry, offset, stripe, &suboff);LASSERT (rc ==0 ); - lpg->lps_index = stripe; + lpg->lps_index =lov_comp_index (entry, stripe);cl_page_slice_add (page, &lpg->lps_cl, obj, index, &lov_comp_page_ops); - sub =lov_sub_get (env, lio, stripe); + sub =lov_sub_get (env, lio, lpg->lps_index);if (IS_ERR (sub))return PTR_ERR (sub);
drivers/staging/lustre/lustre/lov/lovsub_object.c +5 -4
@@ -79,8 +79,8 @@ static void lovsub_object_free(const struct lu_env *env, struct lu_object *obj)* object handling in lu_object_find. */ if (lov) { -int index =0 ; -int stripe = los->lso_index; +int index =lov_comp_entry (los->lso_index); +int stripe =lov_comp_stripe (los->lso_index);struct lov_layout_raid0 *r0 =lov_r0 (lov, index);LASSERT (lov->lo_type ==LLT_COMP );
@@ -107,8 +107,9 @@ static int lovsub_attr_update(const struct lu_env *env, struct cl_object *obj, const struct cl_attr *attr, unsigned int valid) {struct lov_object *lov =cl2lovsub (obj)->lso_super; +struct lovsub_object *los =cl2lovsub (obj); -lov_r0 (lov,0 )->lo_attr_valid =0 ; +lov_r0 (lov,lov_comp_entry (los->lso_index))->lo_attr_valid =0 ;return 0 ; }
@@ -137,7 +138,7 @@ static void lovsub_req_attr_set(const struct lu_env *env, struct cl_object *obj,* There is no OBD_MD_* flag for obdo::o_stripe_idx, so set it * unconditionally. It never changes anyway. */ - attr->cra_oa->o_stripe_idx = subobj->lso_index; + attr->cra_oa->o_stripe_idx =lov_comp_stripe (subobj->lso_index); }static const struct cl_object_operations lovsub_ops = {
Signature · 1 line
1.8.3.1
PATCH 15/28 lustre: clio: client side implementation for PFL
In reply to James SimmonsFrom: Bobi Jam <[email protected]>
Make client layer support composite layout.
Plain layout will be stored in LOV layer as a composite layout containing a single component.
WC-bug-id: https://jira.whamcloud.com/browse/LU-8998
Reviewed-on: https://review.whamcloud.com/24850
--- .../lustre/include/uapi/linux/lustre/lustre_user.h | 9 + .../staging/lustre/lustre/lov/lov_cl_internal.h | 25 +- drivers/staging/lustre/lustre/lov/lov_ea.c | 21 +- drivers/staging/lustre/lustre/lov/lov_internal.h | 10 +- drivers/staging/lustre/lustre/lov/lov_io.c | 301 +++++++++++---------- drivers/staging/lustre/lustre/lov/lov_lock.c | 83 +++--- drivers/staging/lustre/lustre/lov/lov_object.c | 283 ++++++++++--------- drivers/staging/lustre/lustre/lov/lov_offset.c | 12 +- drivers/staging/lustre/lustre/lov/lov_pack.c | 2 +- drivers/staging/lustre/lustre/lov/lov_page.c | 8 +- 10 files changed, 436 insertions(+), 318 deletions(-)
drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h +9 -0
@@ -401,6 +401,15 @@ struct lu_extent {__u64 e_end; }; +#define DEXT "[ %#llx , %#llx )" +#define PEXT (ext) (ext)->e_start, (ext)->e_end + +static inline bool lu_extent_is_overlapped (struct lu_extent *e1, +struct lu_extent *e2) +{ +return e1->e_start < e2->e_end && e2->e_start < e1->e_end; +} +enum lov_comp_md_entry_flags {LCME_FL_PRIMARY =0x00000001 ,/* Not used */ LCME_FL_STALE =0x00000002 ,/* Not used */
drivers/staging/lustre/lustre/lov/lov_cl_internal.h +10 -15
@@ -224,6 +224,7 @@ struct lov_object {*/ unsigned int lo_entry_count;struct lov_layout_entry { +struct lu_extent lle_extent;struct lov_layout_raid0 lle_raid0; } *lo_entries; } composite;
@@ -320,15 +321,9 @@ struct lov_thread_info {*/ struct lov_io_sub {/** -* true, iff cl_io_init() was successfully executed against -* lov_io_sub::sub_io. +* Linkage into a list (hanging off lov_io::lis_subios) */ -u16 sub_io_initialized:1 , -/** -* True, iff lov_io_sub::sub_io and lov_io_sub::sub_env weren't -* allocated, but borrowed from a per-device emergency pool. -*/ - sub_borrowed:1 ; +struct list_head sub_list;/** * Linkage into a list (hanging off lov_io::lis_active) of all * sub-io's active for the current IO iteration.
@@ -340,7 +335,7 @@ struct lov_io_sub {* independently, with lov acting as a scheduler to maximize overall * throughput. */ -struct cl_io *sub_io; +struct cl_io sub_io;/** * environment, in which sub-io executes. */
@@ -351,6 +346,7 @@ struct lov_io_sub {* \see cl_env_get() */ u16 sub_refcheck; +u16 sub_reenter; };/**
@@ -384,14 +380,13 @@ struct lov_io {* exclusive (i.e., next offset after last byte affected by io). */ u64 lis_endpos; -int lis_stripe_count; -int lis_active_subios; +int lis_nr_subios;/** * the index of ls_single_subio in ls_subios array */ int lis_single_subio_index; -struct cl_io lis_single_subio; +struct lov_io_sub lis_single_subio;/** * List of active sub-io's. Active sub-io's are under the range
@@ -400,10 +395,9 @@ struct lov_io {struct list_head lis_active;/** -* size of ls_subios array, actually the highest stripe # +* All sub-io's created in this lov_io. */ -int lis_nr_subios; -struct lov_io_sub *lis_subs; +struct list_head lis_subios; };struct lov_session {
@@ -466,6 +460,7 @@ struct lu_object *lovsub_object_alloc(const struct lu_env *env, struct lu_device *dev);struct lov_stripe_md *lov_lsm_addref (struct lov_object *lov); +int lov_lsm_entry (const struct lov_stripe_md *lsm,u64 offset);#define lov_foreach_target (lov, var) \ for (var = 0; var < lov_targets_nr(lov); ++var)
drivers/staging/lustre/lustre/lov/lov_ea.c +19 -2
@@ -519,9 +519,26 @@ void dump_lsm(unsigned int level, const struct lov_stripe_md *lsm)struct lov_stripe_md_entry *lse = lsm->lsm_entries[i];CDEBUG (level, -": id: %u, magic 0x%08X, stripe count %u, size %u, layout_gen %u, pool: [" LOV_POOLNAMEF "]\n" , - lse->lsme_id, lse->lsme_magic, +DEXT ": id: %u, magic 0x%08X, stripe count %u, size %u, layout_gen %u, pool: [" LOV_POOLNAMEF "]\n" , +PEXT (&lse->lsme_extent), lse->lsme_id, lse->lsme_magic, lse->lsme_stripe_count, lse->lsme_stripe_size, lse->lsme_layout_gen, lse->lsme_pool_name); } } + +int lov_lsm_entry (const struct lov_stripe_md *lsm,u64 offset) +{ +int i; + +for (i =0 ; i < lsm->lsm_entry_count; i++) { +struct lov_stripe_md_entry *lse = lsm->lsm_entries[i]; + +if ((offset >= lse->lsme_extent.e_start && + offset < lse->lsme_extent.e_end) || + (offset ==OBD_OBJECT_EOF && + lse->lsme_extent.e_end ==OBD_OBJECT_EOF )) +return i; + } + +return -1 ; +}
drivers/staging/lustre/lustre/lov/lov_internal.h +6 -4
@@ -81,7 +81,10 @@ static inline bool lsm_has_objects(struct lov_stripe_md *lsm)static inline unsigned int lov_comp_index (int entry,int stripe) { -return stripe; +LASSERT (entry >=0 && entry <=SHRT_MAX ); +LASSERT (stripe >=0 && stripe <USHRT_MAX ); + +return entry <<16 | stripe; }static inline int lov_comp_stripe (int index)
@@ -91,7 +94,7 @@ static inline int lov_comp_stripe(int index)static inline int lov_comp_entry (int index) { -return 0 ; +return index >>16 ; }struct lsm_operations {
@@ -191,8 +194,7 @@ int lov_stripe_offset(struct lov_stripe_md *lsm, int index, u64 lov_off,u64 lov_size_to_stripe (struct lov_stripe_md *lsm,int index,u64 file_size,int stripeno);int lov_stripe_intersects (struct lov_stripe_md *lsm,int index,int stripeno, -u64 start,u64 end, -u64 *obd_start,u64 *obd_end); +struct lu_extent *ext,u64 *obd_start,u64 *obd_end);int lov_stripe_number (struct lov_stripe_md *lsm,int index,u64 lov_off);pgoff_t lov_stripe_pgoff (struct lov_stripe_md *lsm,int index,pgoff_t stripe_index,int stripe);
drivers/staging/lustre/lustre/lov/lov_io.c +164 -137
523 lines not on this page · raw message
drivers/staging/lustre/lustre/lov/lov_lock.c +48 -35
115 lines not on this page · raw message
drivers/staging/lustre/lustre/lov/lov_object.c +161 -122
573 lines not on this page · raw message
drivers/staging/lustre/lustre/lov/lov_offset.c +11 -1
@@ -225,9 +225,19 @@ u64 lov_size_to_stripe(struct lov_stripe_md *lsm, int index, u64 file_size,* stripe does intersect with the lov extent. */ int lov_stripe_intersects (struct lov_stripe_md *lsm,int index,int stripeno, -u64 start,u64 end,u64 *obd_start,u64 *obd_end) +struct lu_extent *ext,u64 *obd_start,u64 *obd_end) { +struct lov_stripe_md_entry *entry = lsm->lsm_entries[index];int start_side, end_side; +u64 start, end; + +if (!lu_extent_is_overlapped (ext, &entry->lsme_extent)) +return 0 ; + + start =max_t (u64, ext->e_start, entry->lsme_extent.e_start); + end =min_t (u64, ext->e_end, entry->lsme_extent.e_end); +if (end !=OBD_OBJECT_EOF ) + end--; start_side =lov_stripe_offset (lsm, index, start, stripeno, obd_start); end_side =lov_stripe_offset (lsm, index, end, stripeno, obd_end);
drivers/staging/lustre/lustre/lov/lov_pack.c +1 -1
@@ -189,8 +189,8 @@ int lov_free_memmd(struct lov_stripe_md **lsmp)int refc; *lsmp =NULL ; -LASSERT (atomic_read (&lsm->lsm_refc) >0 ); refc =atomic_dec_return (&lsm->lsm_refc); +LASSERT (refc >=0 );if (refc ==0 )lsm_free (lsm);
drivers/staging/lustre/lustre/lov/lov_page.c +7 -1
@@ -76,10 +76,16 @@ int lov_page_init_composite(const struct lu_env *env, struct cl_object *obj,u64 offset;u64 suboff;int stripe; -int entry =0 ; +int entry;int rc; offset =cl_offset (obj, index); + entry =lov_lsm_entry (loo->lo_lsm, offset); +if (entry <0 ) { +/* non-existing layout component */ +lov_page_init_empty (env, obj, page, index); +return 0 ; + } r0 =lov_r0 (loo, entry); stripe =lov_stripe_number (loo->lo_lsm, entry, offset);
Signature · 1 line
1.8.3.1
PATCH 16/28 lustre: clio: getstripe support comp layout
In reply to James SimmonsFrom: Niu Yawei <[email protected]>
{get/set}stripe support composite layout
WC-bug-id: https://jira.whamcloud.com/browse/LU-8998
Reviewed-on: https://review.whamcloud.com/24851
--- drivers/staging/lustre/lustre/llite/dir.c | 33 +++- drivers/staging/lustre/lustre/llite/file.c | 25 ++- .../staging/lustre/lustre/llite/llite_internal.h | 2 + drivers/staging/lustre/lustre/llite/xattr.c | 70 +++++---- drivers/staging/lustre/lustre/lov/lov_internal.h | 24 +++ drivers/staging/lustre/lustre/lov/lov_object.c | 3 +- drivers/staging/lustre/lustre/lov/lov_pack.c | 172 ++++++++++++--------- 7 files changed, 203 insertions(+), 126 deletions(-)
drivers/staging/lustre/lustre/llite/dir.c +25 -8
@@ -522,6 +522,15 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump, lum_size =sizeof (struct lov_user_md_v3 );break ; } +case LOV_USER_MAGIC_COMP_V1 : { +if (lump->lmm_magic != +cpu_to_le32 (LOV_USER_MAGIC_COMP_V1 )) +lustre_swab_lov_comp_md_v1 ( + (struct lov_comp_md_v1 *)lump); + lum_size =le32_to_cpu ( + ((struct lov_comp_md_v1 *)lump)->lcm_size); +break ; + }case LMV_USER_MAGIC : {if (lump->lmm_magic !=cpu_to_le32 (LMV_USER_MAGIC )) lustre_swab_lmv_user_md(
@@ -562,7 +571,9 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump,* LOV_USER_MAGIC_V3 have the same initial fields so we do not * need to make the distinction between the 2 versions */ -if (set_default && mgc->u.cli.cl_mgc_mgsexp) { +if (set_default && mgc->u.cli.cl_mgc_mgsexp && + (!lump ||le32_to_cpu (lump->lmm_magic) ==LOV_USER_MAGIC_V1 || +le32_to_cpu (lump->lmm_magic) ==LOV_USER_MAGIC_V3 )) {char *param =NULL ;char *buf;
@@ -577,23 +588,23 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump, buf +=strlen (buf);/* Set root stripesize */ -sprintf (buf,".stripesize=%u" , - lump ?le32_to_cpu (lump->lmm_stripe_size) :0 ); +snprintf (buf,MGS_PARAM_MAXLEN ,".stripesize=%u" , + lump ?le32_to_cpu (lump->lmm_stripe_size) :0 ); rc =ll_send_mgc_param (mgc->u.cli.cl_mgc_mgsexp, param);if (rc) goto end;/* Set root stripecount */ -sprintf (buf,".stripecount=%hd" , - lump ?le16_to_cpu (lump->lmm_stripe_count) :0 ); +snprintf (buf,MGS_PARAM_MAXLEN ,".stripecount=%hd" , + lump ?le16_to_cpu (lump->lmm_stripe_count) :0 ); rc =ll_send_mgc_param (mgc->u.cli.cl_mgc_mgsexp, param);if (rc) goto end;/* Set root stripeoffset */ -sprintf (buf,".stripeoffset=%hd" , - lump ?le16_to_cpu (lump->lmm_stripe_offset) : - (typeof (lump->lmm_stripe_offset))(-1 )); +snprintf (buf,MGS_PARAM_MAXLEN ,".stripeoffset=%hd" , + lump ?le16_to_cpu (lump->lmm_stripe_offset) : + (typeof (lump->lmm_stripe_offset))(-1 )); rc =ll_send_mgc_param (mgc->u.cli.cl_mgc_mgsexp, param); end:
@@ -669,6 +680,10 @@ int ll_dir_getstripe(struct inode *inode, void **plmm, int *plmm_size,if (cpu_to_le32 (LOV_MAGIC ) !=LOV_MAGIC )lustre_swab_lov_user_md_v3 ((struct lov_user_md_v3 *)lmm);break ; +case LOV_MAGIC_COMP_V1 : +if (LOV_MAGIC !=cpu_to_le32 (LOV_MAGIC )) +lustre_swab_lov_comp_md_v1 ((struct lov_comp_md_v1 *)lmm); +break ;case LMV_MAGIC_V1 :if (cpu_to_le32 (LMV_MAGIC ) !=LMV_MAGIC )lustre_swab_lmv_mds_md ((union lmv_mds_md *)lmm);
@@ -1217,6 +1232,8 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)int set_default =0 ; +BUILD_BUG_ON (sizeof (struct lov_user_md_v3 ) <= +sizeof (struct lov_comp_md_v1 ));LASSERT (sizeof (lumv3) ==sizeof (*lumv3p));LASSERT (sizeof (lumv3.lmm_objects[0 ]) ==sizeof (lumv3p->lmm_objects[0 ]));
drivers/staging/lustre/lustre/llite/file.c +12 -13
@@ -1430,8 +1430,9 @@ int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename, lmm =req_capsule_server_sized_get (&req->rq_pill, &RMF_MDT_MD , lmmsize); -if ((lmm->lmm_magic !=cpu_to_le32 (LOV_MAGIC_V1 )) && - (lmm->lmm_magic !=cpu_to_le32 (LOV_MAGIC_V3 ))) { +if (lmm->lmm_magic !=cpu_to_le32 (LOV_MAGIC_V1 ) && + lmm->lmm_magic !=cpu_to_le32 (LOV_MAGIC_V3 ) && + lmm->lmm_magic !=cpu_to_le32 (LOV_MAGIC_COMP_V1 )) { rc = -EPROTO ; goto out; }
@@ -1444,9 +1445,13 @@ int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename,if (cpu_to_le32 (LOV_MAGIC ) !=LOV_MAGIC ) {int stripe_count; - stripe_count =le16_to_cpu (lmm->lmm_stripe_count); -if (le32_to_cpu (lmm->lmm_pattern) &LOV_PATTERN_F_RELEASED ) - stripe_count =0 ; +if (lmm->lmm_magic ==cpu_to_le32 (LOV_MAGIC_V1 ) || + lmm->lmm_magic ==cpu_to_le32 (LOV_MAGIC_V3 )) { + stripe_count =le16_to_cpu (lmm->lmm_stripe_count); +if (le32_to_cpu (lmm->lmm_pattern) & +LOV_PATTERN_F_RELEASED ) + stripe_count =0 ; + }/* if function called for directory - we should * avoid swab not existent lsm objects
@@ -1463,6 +1468,8 @@ int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename,lustre_swab_lov_user_md_objects ( ((struct lov_user_md_v3 *)lmm)->lmm_objects, stripe_count); + }else if (lmm->lmm_magic ==cpu_to_le32 (LOV_MAGIC_COMP_V1 )) { +lustre_swab_lov_comp_md_v1 ((struct lov_comp_md_v1 *)lmm); } }
@@ -1534,14 +1541,6 @@ static int ll_lov_setstripe(struct inode *inode, struct file *file, rc =ll_lov_setstripe_ea_info (inode, file->f_path.dentry, flags, klum, lum_size);cl_lov_delay_create_clear (&file->f_flags); -if (rc ==0 ) { -__u32 gen; - -put_user (0 , &lum->lmm_stripe_count); - -ll_layout_refresh (inode, &gen); - rc =ll_file_getstripe (inode, (struct lov_user_md __user *)arg); - }kfree (klum);return rc;
drivers/staging/lustre/lustre/llite/llite_internal.h +2 -0
@@ -927,6 +927,8 @@ static inline ssize_t ll_lov_user_md_size(const struct lov_user_md *lum)return lov_user_md_size (lum->lmm_stripe_count,LOV_USER_MAGIC_SPECIFIC ); +case LOV_USER_MAGIC_COMP_V1 : +return ((struct lov_comp_md_v1 *)lum)->lcm_size; }return -EINVAL ; }
drivers/staging/lustre/lustre/llite/xattr.c +43 -27
89 lines not on this page · raw message
drivers/staging/lustre/lustre/lov/lov_internal.h +24 -0
@@ -74,6 +74,30 @@ struct lov_stripe_md {struct lov_stripe_md_entry *lsm_entries[]; }; +static inline size_t lov_comp_md_size (const struct lov_stripe_md *lsm) +{ +struct lov_stripe_md_entry *lsme; +size_t size; +int entry; + +if (lsm->lsm_magic ==LOV_MAGIC_V1 || lsm->lsm_magic ==LOV_MAGIC_V3 ) +return lov_mds_md_size (lsm->lsm_entries[0 ]->lsme_stripe_count, + lsm->lsm_entries[0 ]->lsme_magic); + +LASSERT (lsm->lsm_magic ==LOV_MAGIC_COMP_V1 ); + + size =sizeof (struct lov_comp_md_v1 ); +for (entry =0 ; entry < lsm->lsm_entry_count; entry++) { + lsme = lsm->lsm_entries[entry]; + + size +=sizeof (*lsme); + size +=lov_mds_md_size (lsme->lsme_stripe_count, + lsme->lsme_magic); + } + +return size; +} +static inline bool lsm_has_objects (struct lov_stripe_md *lsm) {return lsm && !lsm->lsm_is_released;
drivers/staging/lustre/lustre/lov/lov_object.c +1 -2
@@ -1641,8 +1641,7 @@ static int lov_object_layout_get(const struct lu_env *env,return 0 ; } - cl->cl_size =lov_mds_md_size (lsm->lsm_entries[0 ]->lsme_stripe_count, - lsm->lsm_magic); + cl->cl_size =lov_comp_md_size (lsm); cl->cl_layout_gen = lsm->lsm_layout_gen; rc =lov_lsm_pack (lsm, buf->lb_buf, buf->lb_len);
drivers/staging/lustre/lustre/lov/lov_pack.c +96 -76
217 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 17/28 lustre: pfl: enhance PFID EA for PFL
In reply to James SimmonsFrom: Fan Yong <[email protected]>
This is a misc patch that contains some adjustments to store more stripe information in the OST-object's PFID EA (XATTR_NAME_FID). It is client duty to transfer the stripe and PFL information to the OST via the write, setattr and punch RPC. Then OST will store these information in the PFID EA.
WC-bug-id: https://jira.whamcloud.com/browse/LU-8998
Reviewed-on: https://review.whamcloud.com/24882
--- .../lustre/include/uapi/linux/lustre/lustre_idl.h | 14 ++++-- .../lustre/include/uapi/linux/lustre/lustre_user.h | 17 +++---- drivers/staging/lustre/lustre/include/cl_object.h | 1 + drivers/staging/lustre/lustre/lov/lov_internal.h | 16 ++++++ drivers/staging/lustre/lustre/lov/lov_io.c | 2 + drivers/staging/lustre/lustre/lov/lovsub_object.c | 4 ++ drivers/staging/lustre/lustre/osc/osc_io.c | 4 +- .../staging/lustre/lustre/ptlrpc/pack_generic.c | 13 ++++- drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 58 +++++++++++++--------- 9 files changed, 89 insertions(+), 40 deletions(-)
drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h +11 -3
@@ -1134,6 +1134,7 @@ static inline __u32 lov_mds_md_size(__u16 stripes, __u32 lmm_magic)*/ #define OBD_MD_DEFAULT_MEA (0x0040000000000000ULL)/* default MEA */ +#define OBD_MD_FLOSTLAYOUT (0x0080000000000000ULL)/* contain ost_layout */ #define OBD_MD_FLPROJID (0x0100000000000000ULL)/* project ID */ #define OBD_MD_FLALLQUOTA (OBD_MD_FLUSRQUOTA | \
@@ -2625,9 +2626,16 @@ struct obdo {__u32 o_parent_ver;struct lustre_handle o_handle;/* brw: lock handle to prolong locks */ -struct llog_cookie o_lcookie;/* destroy: unlink cookie from MDS, -* obsolete in 2.8, reused in OSP -*/ +/* Originally, the field is llog_cookie for destroy with unlink cookie +* from MDS, it is obsolete in 2.8. Then reuse it by client to transfer +* layout and PFL information in IO, setattr RPCs. Since llog_cookie is +* not used on wire any longer, remove it from the obdo, then it can be +* enlarged freely in the further without affect related RPCs. +* +* sizeof(ost_layout) + sizeof(__u32) == sizeof(llog_cookie). +*/ +struct ost_layout o_layout; +__u32 o_padding_3;__u32 o_uid_h;__u32 o_gid_h;
drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h +7 -10
@@ -154,16 +154,13 @@ static inline bool fid_is_zero(const struct lu_fid *fid)return !fid->f_seq && !fid->f_oid; } -struct filter_fid { -struct lu_fid ff_parent;/* ff_parent.f_ver == file stripe number */ -}; - -/* keep this one for compatibility */ -struct filter_fid_old { -struct lu_fid ff_parent; -__u64 ff_objid; -__u64 ff_seq; -}; +struct ost_layout { +__u32 ol_stripe_size; +__u32 ol_stripe_count; +__u64 ol_comp_start; +__u64 ol_comp_end; +__u32 ol_comp_id; +} __packed;/* Userspace should treat lu_fid as opaque, and only use the following methods * to print or parse them. Other functions (e.g. compare, swab) could be moved
drivers/staging/lustre/lustre/include/cl_object.h +1 -0
@@ -1784,6 +1784,7 @@ struct cl_io {unsigned int sa_avalid;unsigned int sa_xvalid;/* OP_XVALID */ int sa_stripe_index; +struct ost_layout sa_layout;const struct lu_fid *sa_parent_fid; } ci_setattr;struct cl_data_version_io {
drivers/staging/lustre/lustre/lov/lov_internal.h +16 -0
@@ -304,4 +304,20 @@ static inline struct obd_device *lov2obd(const struct lov_obd *lov) return container_of_safe(lov, struct obd_device, u.lov); } +static inline void lov_lsm2layout (struct lov_stripe_md *lsm, +struct lov_stripe_md_entry *lsme, +struct ost_layout *ol) +{ + ol->ol_stripe_size = lsme->lsme_stripe_size; + ol->ol_stripe_count = lsme->lsme_stripe_count; +if (lsm->lsm_magic ==LOV_MAGIC_COMP_V1 ) { + ol->ol_comp_start = lsme->lsme_extent.e_start; + ol->ol_comp_end = lsme->lsme_extent.e_end; + ol->ol_comp_id = lsme->lsme_id; + }else { + ol->ol_comp_start =0 ; + ol->ol_comp_end =0 ; + ol->ol_comp_id =0 ; + } +}#endif
drivers/staging/lustre/lustre/lov/lov_io.c +2 -0
@@ -316,6 +316,8 @@ static void lov_io_sub_inherit(struct lov_io_sub *sub, struct lov_io *lio, stripe); io->u.ci_setattr.sa_attr.lvb_size = new_size; } +lov_lsm2layout (lsm, lsm->lsm_entries[index], + &io->u.ci_setattr.sa_layout);break ; }case CIT_DATA_VERSION : {
drivers/staging/lustre/lustre/lov/lovsub_object.c +4 -0
@@ -131,6 +131,7 @@ static void lovsub_req_attr_set(const struct lu_env *env, struct cl_object *obj, struct cl_req_attr *attr) {struct lovsub_object *subobj =cl2lovsub (obj); +struct lov_stripe_md *lsm = subobj->lso_super->lo_lsm;cl_req_attr_set (env, &subobj->lso_super->lo_cl, attr);
@@ -139,6 +140,9 @@ static void lovsub_req_attr_set(const struct lu_env *env, struct cl_object *obj,* unconditionally. It never changes anyway. */ attr->cra_oa->o_stripe_idx =lov_comp_stripe (subobj->lso_index); +lov_lsm2layout (lsm, lsm->lsm_entries[lov_comp_entry (subobj->lso_index)], + &attr->cra_oa->o_layout); + attr->cra_oa->o_valid |=OBD_MD_FLOSTLAYOUT ; }static const struct cl_object_operations lovsub_ops = {
drivers/staging/lustre/lustre/osc/osc_io.c +3 -1
@@ -542,7 +542,9 @@ static int osc_io_setattr_start(const struct lu_env *env, oa->o_oi = loi->loi_oi;obdo_set_parent_fid (oa, io->u.ci_setattr.sa_parent_fid); oa->o_stripe_idx = io->u.ci_setattr.sa_stripe_index; - oa->o_valid |=OBD_MD_FLID |OBD_MD_FLGROUP ; + oa->o_layout = io->u.ci_setattr.sa_layout; + oa->o_valid |=OBD_MD_FLID |OBD_MD_FLGROUP | +OBD_MD_FLOSTLAYOUT ;if (ia_avalid &ATTR_CTIME ) { oa->o_valid |=OBD_MD_FLCTIME ; oa->o_ctime = attr->cat_ctime;
drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +11 -2
@@ -1587,6 +1587,15 @@ void lustre_swab_connect(struct obd_connect_data *ocd) BUILD_BUG_ON(offsetof(typeof(*ocd), paddingF) == 0); } +static void lustre_swab_ost_layout (struct ost_layout *ol) +{ +__swab32s (&ol->ol_stripe_size); +__swab32s (&ol->ol_stripe_count); +__swab64s (&ol->ol_comp_start); +__swab64s (&ol->ol_comp_end); +__swab32s (&ol->ol_comp_id); +} +static void lustre_swab_obdo (struct obdo *o) {__swab64s (&o->o_valid);
@@ -1609,8 +1618,8 @@ static void lustre_swab_obdo(struct obdo *o)__swab64s (&o->o_ioepoch);__swab32s (&o->o_stripe_idx);__swab32s (&o->o_parent_ver); -/* o_handle is opaque */ -/* o_lcookie is swabbed elsewhere */ +lustre_swab_ost_layout (&o->o_layout); + BUILD_BUG_ON(offsetof(typeof(*o), o_padding_3) == 0);__swab32s (&o->o_uid_h);__swab32s (&o->o_gid_h);__swab64s (&o->o_data_version);
drivers/staging/lustre/lustre/ptlrpc/wiretest.c +34 -24
82 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 18/28 lustre: pfl: dynamic layout modification with write/truncate
In reply to James SimmonsFrom: Bobi Jam <[email protected]>
* in lov_init_composite(), skip init sub object without LCME_FL_INIT layout component.
* issue layout intent RPC during write/trunc ops when try to write to an un-init-ed component (even if at the lock stage).
* After layout intent RPC issued, restart the IO.
* get rid of unused lov_layout_operations::llo_install() interface.
* add an empty mdt_layout_change() interface to handle intent layout write RPC.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9008
Reviewed-on: https://review.whamcloud.com/25317
WC-bug-id: https://jira.whamcloud.com/browse/LU-9307
Reviewed-on: https://review.whamcloud.com/26456
WC-bug-id: https://jira.whamcloud.com/browse/LU-9311
Reviewed-on: https://review.whamcloud.com/26474
--- .../lustre/include/uapi/linux/lustre/lustre_idl.h | 18 ++-- drivers/staging/lustre/lustre/include/cl_object.h | 5 + drivers/staging/lustre/lustre/include/lustre_sec.h | 4 +- drivers/staging/lustre/lustre/llite/file.c | 104 ++++++++++++++------- .../staging/lustre/lustre/llite/llite_internal.h | 1 + drivers/staging/lustre/lustre/llite/vvp_io.c | 36 ++++++- drivers/staging/lustre/lustre/lov/lov_ea.c | 51 +++++++--- drivers/staging/lustre/lustre/lov/lov_internal.h | 22 +++++ drivers/staging/lustre/lustre/lov/lov_io.c | 49 ++++++++-- drivers/staging/lustre/lustre/lov/lov_lock.c | 11 ++- drivers/staging/lustre/lustre/lov/lov_object.c | 53 +++++------ drivers/staging/lustre/lustre/lov/lov_pack.c | 19 ++-- drivers/staging/lustre/lustre/lov/lov_page.c | 2 +- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 79 +++++++++------- drivers/staging/lustre/lustre/obdclass/genops.c | 16 +++- drivers/staging/lustre/lustre/ptlrpc/layout.c | 6 +- .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 7 +- drivers/staging/lustre/lustre/ptlrpc/sec.c | 5 +- 18 files changed, 338 insertions(+), 150 deletions(-)
drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h +9 -9
@@ -2772,22 +2772,22 @@ struct getparent { } __packed;enum { -LAYOUT_INTENT_ACCESS =0 , -LAYOUT_INTENT_READ =1 , -LAYOUT_INTENT_WRITE =2 , -LAYOUT_INTENT_GLIMPSE =3 , -LAYOUT_INTENT_TRUNC =4 , -LAYOUT_INTENT_RELEASE =5 , -LAYOUT_INTENT_RESTORE =6 +LAYOUT_INTENT_ACCESS =0 ,/** generic access */ +LAYOUT_INTENT_READ =1 ,/** not used */ +LAYOUT_INTENT_WRITE =2 ,/** write file, for comp layout */ +LAYOUT_INTENT_GLIMPSE =3 ,/** not used */ +LAYOUT_INTENT_TRUNC =4 ,/** truncate file, for comp layout */ +LAYOUT_INTENT_RELEASE =5 ,/** reserved for HSM release */ +LAYOUT_INTENT_RESTORE =6 /** reserved for HSM restore */ };/* enqueue layout lock with intent */ struct layout_intent { -__u32 li_opc;/* intent operation for enqueue, read, write etc */ +__u32 li_opc;/* intent operation for enqueue, read, write etc */ __u32 li_flags;__u64 li_start;__u64 li_end; -}; +} __packed;/** * On the wire version of hsm_progress structure.
drivers/staging/lustre/lustre/include/cl_object.h +5 -0
@@ -1843,6 +1843,11 @@ struct cl_io {*/ ci_ignore_layout:1 ,/** +* Need MDS intervention to complete a write. This usually means the +* corresponding component is not initialized for the writing extent. +*/ + ci_need_write_intent:1, +/** * Check if layout changed after the IO finishes. Mainly for HSM * requirement. If IO occurs to openning files, it doesn't need to * verify layout because HSM won't release openning files.
drivers/staging/lustre/lustre/include/lustre_sec.h +3 -1
@@ -65,6 +65,7 @@struct ptlrpc_svc_ctx ;struct ptlrpc_cli_ctx ;struct ptlrpc_ctx_ops ; +struct req_msg_field ;/** * \addtogroup flavor flavor
@@ -976,7 +977,8 @@ int cli_ctx_is_eternal(struct ptlrpc_cli_ctx *ctx)int sptlrpc_cli_alloc_repbuf (struct ptlrpc_request *req,int msgsize);void sptlrpc_cli_free_repbuf (struct ptlrpc_request *req);int sptlrpc_cli_enlarge_reqbuf (struct ptlrpc_request *req, -int segment,int newsize); +const struct req_msg_field *field, +int newsize);int sptlrpc_cli_unwrap_early_reply (struct ptlrpc_request *req,struct ptlrpc_request **req_ret);void sptlrpc_cli_finish_early_reply (struct ptlrpc_request *early_req);
drivers/staging/lustre/lustre/llite/file.c +70 -34
163 lines not on this page · raw message
drivers/staging/lustre/lustre/llite/llite_internal.h +1 -0
@@ -1320,6 +1320,7 @@ static inline void d_lustre_revalidate(struct dentry *dentry)int ll_layout_conf (struct inode *inode,const struct cl_object_conf *conf);int ll_layout_refresh (struct inode *inode,__u32 *gen);int ll_layout_restore (struct inode *inode,loff_t start,__u64 length); +int ll_layout_write_intent (struct inode *inode,u64 start,u64 end);int ll_xattr_init (void );void ll_xattr_fini (void );
drivers/staging/lustre/lustre/llite/vvp_io.c +32 -4
@@ -281,18 +281,18 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios)struct cl_object *obj = io->ci_obj;struct vvp_io *vio =cl2vvp_io (env, ios);struct inode *inode =vvp_object_inode (obj); +int rc;CLOBINVRNT (env, obj,vvp_object_invariant (obj));CDEBUG (D_VFSTRACE ,DFID -" ignore/verify layout %d/%d, layout version %d restore needed %d\n" , +" ignore/verify layout %d/%d, layout version %d need write layout %d, restore needed %d\n" ,PFID (lu_object_fid (&obj->co_lu)), io->ci_ignore_layout, io->ci_verify_layout, - vio->vui_layout_gen, io->ci_restore_needed); + vio->vui_layout_gen, io->ci_need_write_intent, + io->ci_restore_needed);if (io->ci_restore_needed) { -int rc; -/* file was detected release, we need to restore it * before finishing the io */
@@ -318,6 +318,34 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) } } +/** +* dynamic layout change needed, send layout intent +* RPC. +*/ +if (io->ci_need_write_intent) { +loff_t start =0 ; +loff_t end =0 ; + +LASSERT (io->ci_type ==CIT_WRITE ||cl_io_is_trunc (io)); + + io->ci_need_write_intent =0 ; + +if (io->ci_type ==CIT_WRITE ) { + start = io->u.ci_rw.crw_pos; + end = io->u.ci_rw.crw_pos + io->u.ci_rw.crw_count; + }else { + end = io->u.ci_setattr.sa_attr.lvb_size; + } + +CDEBUG (D_VFSTRACE ,DFID " type %d [%llx, %llx)\n" , +PFID (lu_object_fid (&obj->co_lu)), io->ci_type, + start, end); + rc =ll_layout_write_intent (inode, start, end); + io->ci_result = rc; +if (!rc) + io->ci_need_restart =1 ; + } +if (!io->ci_ignore_layout && io->ci_verify_layout) {__u32 gen =0 ;
drivers/staging/lustre/lustre/lov/lov_ea.c +39 -12
131 lines not on this page · raw message
drivers/staging/lustre/lustre/lov/lov_internal.h +22 -0
@@ -48,6 +48,7 @@ struct lov_stripe_md_entry {struct lu_extent lsme_extent;u32 lsme_id;u32 lsme_magic; +u32 lsme_flags;u32 lsme_pattern;u32 lsme_stripe_size;u16 lsme_stripe_count;
@@ -56,6 +57,17 @@ struct lov_stripe_md_entry {struct lov_oinfo *lsme_oinfo[]; }; +static inline void copy_lsm_entry (struct lov_stripe_md_entry *dst, +struct lov_stripe_md_entry *src) +{ +unsigned int i; + +for (i =0 ; i < src->lsme_stripe_count; i++) + *dst->lsme_oinfo[i] = *src->lsme_oinfo[i]; + + memcpy(dst, src, offsetof(typeof(*src), lsme_oinfo)); +} +struct lov_stripe_md {atomic_t lsm_refc;spinlock_t lsm_lock;
@@ -74,6 +86,16 @@ struct lov_stripe_md {struct lov_stripe_md_entry *lsm_entries[]; }; +static inline bool lsme_inited (const struct lov_stripe_md_entry *lsme) +{ +return lsme->lsme_flags &LCME_FL_INIT ; +} + +static inline bool lsm_entry_inited (const struct lov_stripe_md *lsm,int index) +{ +return lsme_inited (lsm->lsm_entries[index]); +} +static inline size_t lov_comp_md_size (const struct lov_stripe_md *lsm) {struct lov_stripe_md_entry *lsme;
drivers/staging/lustre/lustre/lov/lov_io.c +42 -7
97 lines not on this page · raw message
drivers/staging/lustre/lustre/lov/lov_lock.c +7 -4
@@ -132,7 +132,7 @@ static struct lov_lock *lov_lock_sub_init(const struct lu_env *env, nr =0 ;for (index =lov_lsm_entry (lov->lo_lsm, ext.e_start); - index !=-1 && index < lov->lo_lsm->lsm_entry_count; index++) { + index >=0 && index < lov->lo_lsm->lsm_entry_count; index++) {struct lov_layout_raid0 *r0 =lov_r0 (lov, index);/* assume lsm entries are sorted. */
@@ -147,8 +147,11 @@ static struct lov_lock *lov_lock_sub_init(const struct lu_env *env, nr++; } } -if (nr ==0 ) -return ERR_PTR (-EINVAL ); +/** +* Aggressive lock request (from cl_setattr_ost) which asks for +* [eof, -1) lock, could come across uninstantiated layout extent, +* hence a 0 nr is possible. +*/ lovlck = kvzalloc(offsetof(struct lov_lock, lls_sub[nr]), GFP_NOFS);
@@ -158,7 +161,7 @@ static struct lov_lock *lov_lock_sub_init(const struct lu_env *env, lovlck->lls_nr = nr; nr =0 ;for (index =lov_lsm_entry (lov->lo_lsm, ext.e_start); - index < lov->lo_lsm->lsm_entry_count; index++) { + index >=0 && index < lov->lo_lsm->lsm_entry_count; index++) {struct lov_layout_raid0 *r0 =lov_r0 (lov, index);/* assume lsm entries are sorted. */
drivers/staging/lustre/lustre/lov/lov_object.c +25 -28
149 lines not on this page · raw message
drivers/staging/lustre/lustre/lov/lov_pack.c +13 -6
@@ -146,6 +146,9 @@ ssize_t lov_lsm_pack_v1v3(const struct lov_stripe_md *lsm, void *buf, lmm_objects = lmmv1->lmm_objects; } +if (lsm->lsm_is_released) +return lmm_size; +for (i =0 ; i < lsm->lsm_entries[0 ]->lsme_stripe_count; i++) {struct lov_oinfo *loi = lsm->lsm_entries[0 ]->lsme_oinfo[i];
@@ -189,11 +192,13 @@ ssize_t lov_lsm_pack(const struct lov_stripe_md *lsm, void *buf,for (entry =0 ; entry < lsm->lsm_entry_count; entry++) {struct lov_stripe_md_entry *lsme;struct lov_mds_md *lmm; +u16 stripecnt; lsme = lsm->lsm_entries[entry]; lcme = &lcmv1->lcm_entries[entry]; lcme->lcme_id =cpu_to_le32 (lsme->lsme_id); + lcme->lcme_flags =cpu_to_le32 (lsme->lsme_flags); lcme->lcme_extent.e_start =cpu_to_le64 (lsme->lsme_extent.e_start); lcme->lcme_extent.e_end =
@@ -220,7 +225,13 @@ ssize_t lov_lsm_pack(const struct lov_stripe_md *lsm, void *buf, lmm_objects = ((struct lov_mds_md_v1 *)lmm)->lmm_objects; } -for (i =0 ; i < lsme->lsme_stripe_count; i++) { +if (lsme_inited (lsme) && + !(lsme->lsme_pattern &LOV_PATTERN_F_RELEASED )) + stripecnt = lsme->lsme_stripe_count; +else + stripecnt =0 ; + +for (i =0 ; i < stripecnt; i++) {struct lov_oinfo *loi = lsme->lsme_oinfo[i];ostid_cpu_to_le (&loi->loi_oi, &lmm_objects[i].l_ost_oi);
@@ -230,8 +241,7 @@ ssize_t lov_lsm_pack(const struct lov_stripe_md *lsm, void *buf,cpu_to_le32 (loi->loi_ost_idx); } - size =lov_mds_md_size (lsme->lsme_stripe_count, - lsme->lsme_magic); + size =lov_mds_md_size (stripecnt, lsme->lsme_magic); lcme->lcme_size =cpu_to_le32 (size); offset += size; }/* for each layout component */
@@ -314,9 +324,6 @@ int lov_getstripe(struct lov_object *obj, struct lov_stripe_md *lsm,size_t lmmk_size;int rc =0 ; -if (!lsm) -return -ENODATA ; -if (lsm->lsm_magic !=LOV_MAGIC_V1 && lsm->lsm_magic !=LOV_MAGIC_V3 && lsm->lsm_magic !=LOV_MAGIC_COMP_V1 ) { CERROR("bad LSM MAGIC: 0x%08X != 0x%08X nor 0x%08X\n",
drivers/staging/lustre/lustre/lov/lov_page.c +1 -1
@@ -81,7 +81,7 @@ int lov_page_init_composite(const struct lu_env *env, struct cl_object *obj, offset =cl_offset (obj, index); entry =lov_lsm_entry (loo->lo_lsm, offset); -if (entry <0 ) { +if (entry <0 || !lsm_entry_inited (loo->lo_lsm, entry)) {/* non-existing layout component */ lov_page_init_empty (env, obj, page, index);return 0 ;
drivers/staging/lustre/lustre/mdc/mdc_locks.c +44 -35
111 lines not on this page · raw message
drivers/staging/lustre/lustre/obdclass/genops.c +12 -4
@@ -1546,6 +1546,16 @@ static inline bool obd_mod_rpc_slot_avail(struct client_obd *cli,return avail; } +static inline bool obd_skip_mod_rpc_slot (const struct lookup_intent *it) +{ +if (it && + (it->it_op ==IT_GETATTR || it->it_op ==IT_LOOKUP || + it->it_op ==IT_READDIR || + (it->it_op ==IT_LAYOUT && !(it->it_flags &FMODE_WRITE )))) +return true; +return false; +} +/* Get a modify RPC slot from the obd client @cli according * to the kind of operation @opc that is going to be sent * and the intent @it of the operation if it applies.
@@ -1563,8 +1573,7 @@ u16 obd_get_mod_rpc_slot(struct client_obd *cli, __u32 opc,/* read-only metadata RPCs don't consume a slot on MDT * for reply reconstruction */ -if (it && (it->it_op ==IT_GETATTR || it->it_op ==IT_LOOKUP || - it->it_op ==IT_LAYOUT || it->it_op ==IT_READDIR )) +if (obd_skip_mod_rpc_slot (it))return 0 ;if (opc ==MDS_CLOSE )
@@ -1610,8 +1619,7 @@ void obd_put_mod_rpc_slot(struct client_obd *cli, u32 opc, {bool close_req = false; -if (it && (it->it_op ==IT_GETATTR || it->it_op ==IT_LOOKUP || - it->it_op ==IT_LAYOUT || it->it_op ==IT_READDIR )) +if (obd_skip_mod_rpc_slot (it))return ;if (opc ==MDS_CLOSE )
drivers/staging/lustre/lustre/ptlrpc/layout.c +3 -3
@@ -1797,9 +1797,9 @@ int req_capsule_server_pack(struct req_capsule *pill)* Returns the PTLRPC request or reply (\a loc) buffer offset of a \a pill * corresponding to the given RMF (\a field). */ -static u32 __req_capsule_offset (const struct req_capsule *pill, -const struct req_msg_field *field, -enum req_location loc) +u32 __req_capsule_offset (const struct req_capsule *pill, +const struct req_msg_field *field, +enum req_location loc) {u32 offset;
drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h +6 -1
@@ -88,7 +88,7 @@ void ptlrpc_set_add_new_req(struct ptlrpcd_ctl *pc,void ptlrpc_initiate_recovery (struct obd_import *imp);int lustre_unpack_req_ptlrpc_body (struct ptlrpc_request *req,int offset); -int lustre_unpack_rep_ptlrpc_body (struct ptlrpc_request *req,int offset); +int lustre_unpack_rep_ptlrpc_body (struct ptlrpc_request *req,int effset);int ptlrpc_sysfs_register_service (struct kset *parent,struct ptlrpc_service *svc);
@@ -284,6 +284,11 @@ void sptlrpc_conf_choose_flavor(enum lustre_sec_part from,int sptlrpc_init (void );void sptlrpc_fini (void ); +/* layout.c */ +u32 __req_capsule_offset (const struct req_capsule *pill, +const struct req_msg_field *field, +enum req_location loc); +static inline bool ptlrpc_recoverable_error (int rc) {return (rc == -ENOTCONN || rc == -ENODEV );
drivers/staging/lustre/lustre/ptlrpc/sec.c +4 -1
@@ -1611,11 +1611,14 @@ void _sptlrpc_enlarge_msg_inplace(struct lustre_msg *msg,* so caller should refresh its local pointers if needed. */ int sptlrpc_cli_enlarge_reqbuf (struct ptlrpc_request *req, -int segment,int newsize) +const struct req_msg_field *field, +int newsize) { +struct req_capsule *pill = &req->rq_pill;struct ptlrpc_cli_ctx *ctx = req->rq_cli_ctx;struct ptlrpc_sec_cops *cops;struct lustre_msg *msg = req->rq_reqmsg; +int segment =__req_capsule_offset (pill, field,RCL_CLIENT );LASSERT (ctx);LASSERT (msg);
Signature · 1 line
1.8.3.1
PATCH 19/28 lustre: pfl: calculate PFL file LOVEA correctly
In reply to James SimmonsFrom: Bobi Jam <[email protected]>
PFL file could contain uninstantiated component, so it could still keeps the specified -1 stripe count, lov_mds_md_size()/lov_user_md_size() should heed this case, otherwise its LOVEA size could be errneous big.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9335
Reviewed-on: https://review.whamcloud.com/26597
--- drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h | 3 +++ drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h | 3 +++ 2 files changed, 6 insertions(+)
drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h +3 -0
@@ -1036,6 +1036,9 @@ struct lov_mds_md_v3 { /* LOV EA mds/wire data (little-endian) */static inline __u32 lov_mds_md_size (__u16 stripes,__u32 lmm_magic) { +if (stripes == (__u16)-1 ) + stripes =0 ; +if (lmm_magic ==LOV_MAGIC_V3 )return sizeof (struct lov_mds_md_v3 ) + stripes *sizeof (struct lov_ost_data_v1 );
drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h +3 -0
@@ -457,6 +457,9 @@ struct lov_comp_md_v1 {static inline __u32 lov_user_md_size (__u16 stripes,__u32 lmm_magic) { +if (stripes == (__u16)-1 ) + stripes =0 ; +if (lmm_magic ==LOV_USER_MAGIC_V1 )return sizeof (struct lov_user_md_v1 ) + stripes *sizeof (struct lov_user_ost_data_v1 );
Signature · 1 line
1.8.3.1
PATCH 20/28 lustre: lov: keep minimum LOVEA size
In reply to James SimmonsFrom: Bobi Jam <[email protected]>
For a PFL file, some of its component could be un-instantiated, and their lov_ost_data_v1 array is not needed, we should keep its LOVEA as small as possible.
An unstantiated component's stripe offset should be set.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9489
Reviewed-on: https://review.whamcloud.com/27089
WC-bug-id: https://jira.whamcloud.com/browse/LU-9941
Reviewed-on: https://review.whamcloud.com/28845
--- drivers/staging/lustre/lustre/lov/lov_internal.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/staging/lustre/lustre/lov/lov_internal.h +12 -0
@@ -96,6 +96,11 @@ static inline bool lsm_entry_inited(const struct lov_stripe_md *lsm, int index)return lsme_inited (lsm->lsm_entries[index]); } +static inline bool lsm_is_composite (u32 magic) +{ +return magic ==LOV_MAGIC_COMP_V1 ; +} +static inline size_t lov_comp_md_size (const struct lov_stripe_md *lsm) {struct lov_stripe_md_entry *lsme;
@@ -110,8 +115,15 @@ static inline size_t lov_comp_md_size(const struct lov_stripe_md *lsm) size =sizeof (struct lov_comp_md_v1 );for (entry =0 ; entry < lsm->lsm_entry_count; entry++) { +u16 stripe_count; + lsme = lsm->lsm_entries[entry]; +if (lsme_inited (lsme)) + stripe_count = lsme->lsme_stripe_count; +else + stripe_count =0 ; + size +=sizeof (*lsme); size +=lov_mds_md_size (lsme->lsme_stripe_count, lsme->lsme_magic);
Signature · 1 line
1.8.3.1
PATCH 21/28 lustre: pfl: Read should not trigger layout write intent
In reply to James SimmonsFrom: Jinshan Xiong <[email protected]>
In lov_io_rw_iter_init(), only write not read operation should trigger layout write intent.
For append write, it has to make sure all uninited components are instantiated.
Page mkwrite should also trigger write intent.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9008
Reviewed-on: https://review.whamcloud.com/26499
--- drivers/staging/lustre/lustre/llite/vvp_io.c | 20 ++++++++++++----- drivers/staging/lustre/lustre/lov/lov_io.c | 33 +++++++++++++++++----------- 2 files changed, 34 insertions(+), 19 deletions(-)
drivers/staging/lustre/lustre/llite/vvp_io.c +14 -6
@@ -323,18 +323,26 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios)* RPC. */ if (io->ci_need_write_intent) { +loff_t end =OBD_OBJECT_EOF ;loff_t start =0 ; -loff_t end =0 ; - -LASSERT (io->ci_type ==CIT_WRITE ||cl_io_is_trunc (io)); io->ci_need_write_intent =0 ; +LASSERT (io->ci_type ==CIT_WRITE || +cl_io_is_trunc (io) ||cl_io_is_mkwrite (io)); +if (io->ci_type ==CIT_WRITE ) { - start = io->u.ci_rw.crw_pos; - end = io->u.ci_rw.crw_pos + io->u.ci_rw.crw_count; - }else { +if (!cl_io_is_append (io)) { + start = io->u.ci_rw.crw_pos; + end = start + io->u.ci_rw.crw_count; + } + }else if (cl_io_is_trunc (io)) { end = io->u.ci_setattr.sa_attr.lvb_size; + }else {/* mkwrite */ +pgoff_t index = io->u.ci_fault.ft_index; + + start =cl_offset (io->ci_obj, index); + end =cl_offset (io->ci_obj, index +1 ); } CDEBUG(D_VFSTRACE, DFID" type %d [%llx, %llx)\n",
drivers/staging/lustre/lustre/lov/lov_io.c +20 -13
@@ -378,6 +378,7 @@ static int lov_io_iter_init(const struct lu_env *env, {struct lov_io *lio =cl2lov_io (env, ios);struct lov_stripe_md *lsm = lio->lis_object->lo_lsm; +struct cl_io *io = ios->cis_io;struct lov_layout_entry *le;struct lov_io_sub *sub;struct lu_extent ext;
@@ -394,15 +395,28 @@ static int lov_io_iter_init(const struct lu_env *env,u64 start;u64 end; -CDEBUG (D_VFSTRACE ,"component[%d] flags %#x\n" , - index, lsm->lsm_entries[index]->lsme_flags); -if (!lsm_entry_inited (lsm, index)) -break ; - index++;if (!lu_extent_is_overlapped (&ext, &le->lle_extent))continue ; +CDEBUG (D_VFSTRACE ,"component[%d] flags %#x\n" , + index -1 , lsm->lsm_entries[index -1 ]->lsme_flags); +if (!lsm_entry_inited (lsm, index -1 )) { +/* truncate IO will trigger write intent as well, and +* it's handled in lov_io_setattr_iter_init() +*/ +if (io->ci_type ==CIT_WRITE ||cl_io_is_mkwrite (io)) { + io->ci_need_write_intent =1 ; + rc = -ENODATA ; +break ; + } + +/* Read from uninitialized components should return +* zero filled pages. +*/ +continue ; + } +for (stripe =0 ; stripe < r0->lo_nr; stripe++) {if (!lov_stripe_intersects (lsm, index -1 , stripe, &ext, &start, &end))
@@ -498,13 +512,6 @@ static int lov_io_rw_iter_init(const struct lu_env *env, start, lio->lis_pos, lio->lis_endpos, lio->lis_io_endpos); - index =lov_lsm_entry (lsm, lio->lis_endpos -1 ); -if (index >0 && !lsm_entry_inited (lsm, index)) { - io->ci_need_write_intent =1 ; - io->ci_result = -ENODATA ; -return io->ci_result; - } -/* * XXX The following call should be optimized: we know, that * [lio->lis_pos, lio->lis_endpos) intersects with exactly one stripe.
@@ -520,7 +527,7 @@ static int lov_io_setattr_iter_init(const struct lu_env *env,struct lov_stripe_md *lsm = lio->lis_object->lo_lsm;int index; -if (cl_io_is_trunc (io) && lio->lis_pos) { +if (cl_io_is_trunc (io) && lio->lis_pos >0 ) { index =lov_lsm_entry (lsm, lio->lis_pos -1 );if (index >0 && !lsm_entry_inited (lsm, index)) { io->ci_need_write_intent =1 ;
Signature · 1 line
1.8.3.1
PATCH 22/28 lustre: pfl: fix hang with grouplocks
In reply to James SimmonsFrom: Bobi Jam <[email protected]>
This is a makeshift fix. When we hold a group lock of a file, there should no data written to the file, since during the write IO, the file's layout could possibly change, and the write IO will try to update its layout, which could be blocked by itself.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9344
Reviewed-on: https://review.whamcloud.com/26646
--- drivers/staging/lustre/lustre/include/cl_object.h | 2 ++ drivers/staging/lustre/lustre/llite/file.c | 26 +++++++++++++++++++++++ drivers/staging/lustre/lustre/lov/lov_object.c | 1 + 3 files changed, 29 insertions(+)
drivers/staging/lustre/lustre/include/cl_object.h +2 -0
@@ -288,6 +288,8 @@ struct cl_layout {size_t cl_size;/** Layout generation. */ u32 cl_layout_gen; +/** whether layout is a composite one */ +bool cl_is_composite; };/**
drivers/staging/lustre/lustre/llite/file.c +26 -0
@@ -1551,6 +1551,7 @@ static int ll_lov_setstripe(struct inode *inode, struct file *file, {struct ll_inode_info *lli =ll_i2info (inode);struct ll_file_data *fd =LUSTRE_FPRIVATE (file); +struct cl_object *obj = lli->lli_clob;struct ll_grouplock grouplock;int rc;
@@ -1572,6 +1573,31 @@ static int ll_lov_setstripe(struct inode *inode, struct file *file,LASSERT (!fd->fd_grouplock.lg_lock);spin_unlock (&lli->lli_lock); +/** +* XXX: group lock needs to protect all OST objects while PFL +* can add new OST objects during the IO, so we'd instantiate +* all OST objects before getting its group lock. +*/ +if (obj) { +struct cl_layout cl = { + .cl_is_composite = false, + }; +struct lu_env *env; +u16 refcheck; + + env =cl_env_get (&refcheck); +if (IS_ERR (env)) +return PTR_ERR (env); + + rc =cl_object_layout_get (env, obj, &cl); +if (!rc && cl.cl_is_composite) + rc =ll_layout_write_intent (inode,0 ,OBD_OBJECT_EOF ); + +cl_env_put (env, &refcheck); +if (rc) +return rc; + } + rc =cl_get_grouplock (ll_i2info (inode)->lli_clob, arg, (file->f_flags &O_NONBLOCK ), &grouplock);if (rc)
drivers/staging/lustre/lustre/lov/lov_object.c +1 -0
@@ -1637,6 +1637,7 @@ static int lov_object_layout_get(const struct lu_env *env, cl->cl_size =lov_comp_md_size (lsm); cl->cl_layout_gen = lsm->lsm_layout_gen; + cl->cl_is_composite =lsm_is_composite (lsm->lsm_magic); rc =lov_lsm_pack (lsm, buf->lb_buf, buf->lb_len);lov_lsm_put (lsm);
Signature · 1 line
1.8.3.1
PATCH 23/28 lustre: pfl: fix ost pool op->size handling
In reply to James SimmonsFrom: Bobi Jam <[email protected]>
This patch fixes the misunderstanding of ost_pool::op->size, it indicates the buffer size allocated instead of the array count.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9359
Reviewed-on: https://review.whamcloud.com/26706
--- drivers/staging/lustre/lustre/lov/lov_internal.h | 1 - drivers/staging/lustre/lustre/lov/lov_io.c | 3 ++- drivers/staging/lustre/lustre/lov/lov_pool.c | 20 +++++++++++--------- 3 files changed, 13 insertions(+), 11 deletions(-)
drivers/staging/lustre/lustre/lov/lov_internal.h +0 -1
@@ -195,7 +195,6 @@ struct lsm_operations { })#endif -#define pool_tgt_size (p) ((p)->pool_obds.op_size)#define pool_tgt_count (p) ((p)->pool_obds.op_count)#define pool_tgt_array (p) ((p)->pool_obds.op_array)#define pool_tgt_rw_sem (p) ((p)->pool_obds.op_rw_sem)
drivers/staging/lustre/lustre/lov/lov_io.c +2 -1
@@ -100,7 +100,8 @@ static int lov_io_sub_init(const struct lu_env *env, struct lov_io *lio,LASSERT (!sub->sub_env); -if (unlikely (!lov_r0 (lov, index)->lo_sub[stripe])) +if (unlikely (!lov_r0 (lov, index)->lo_sub || + !lov_r0 (lov, index)->lo_sub[stripe]))return -EIO ;/* obtain new environment */
drivers/staging/lustre/lustre/lov/lov_pool.c +11 -9
@@ -238,8 +238,9 @@ int lov_ost_pool_init(struct ost_pool *op, unsigned int count) op->op_array =NULL ; op->op_count =0 ;init_rwsem (&op->op_rw_sem); - op->op_size = count; - op->op_array =kcalloc (op->op_size,sizeof (op->op_array[0 ]),GFP_NOFS ); + op->op_size = count *sizeof (op->op_array[0 ]); + op->op_array =kcalloc (count,sizeof (op->op_array[0 ]), +GFP_KERNEL );if (!op->op_array) { op->op_size =0 ;return -ENOMEM ;
@@ -250,24 +251,25 @@ int lov_ost_pool_init(struct ost_pool *op, unsigned int count)/* Caller must hold write op_rwlock */ int lov_ost_pool_extend (struct ost_pool *op,unsigned int min_count) { -__u32 *new; -int new_size; +int new_count; +u32 *new;LASSERT (min_count !=0 ); -if (op->op_count < op->op_size) +if (op->op_count *sizeof (op->op_array[0 ]) < op->op_size)return 0 ; - new_size =max (min_count,2 * op->op_size); - new =kcalloc (new_size,sizeof (op->op_array[0 ]),GFP_NOFS ); + new_count =max_t (u32, min_count, +2 * op->op_size /sizeof (op->op_array[0 ])); + new =kcalloc (new_count,sizeof (op->op_array[0 ]),GFP_KERNEL );if (!new)return -ENOMEM ;/* copy old array to new one */ -memcpy (new, op->op_array, op->op_size *sizeof (op->op_array[0 ])); +memcpy (new, op->op_array, op->op_size);kfree (op->op_array); op->op_array = new; - op->op_size = new_size; + op->op_size = new_count *sizeof (op->op_array[0 ]);return 0 ; }
Signature · 1 line
1.8.3.1
PATCH 24/28 lustre: lov: readahead shouldn't exceed component boundary
In reply to James SimmonsFrom: Jinshan Xiong <[email protected]>
Otherwise, it will extend the readahead RPC to the next component while the actual lock of that component is not checked.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9340
Reviewed-on: https://review.whamcloud.com/26677
Reviewed-on: https://review.whamcloud.com/26861
--- drivers/staging/lustre/lustre/lov/lov_io.c | 23 ++++++++++++++++------- drivers/staging/lustre/lustre/lov/lov_page.c | 4 +++- 2 files changed, 19 insertions(+), 8 deletions(-)
drivers/staging/lustre/lustre/lov/lov_io.c +16 -7
@@ -684,28 +684,37 @@ static int lov_io_read_ahead(const struct lu_env *env,return rc;/** -* Adjust the stripe index by layout of raid0. ra->cra_end is +* Adjust the stripe index by layout of comp. ra->cra_end is * the maximum page index covered by an underlying DLM lock. * This function converts cra_end from stripe level to file -* level, and make sure it's not beyond stripe boundary. +* level, and make sure it's not beyond stripe and component +* boundary. */ -if (r0->lo_nr ==1 )/* single stripe file */ -return 0 ;/* cra_end is stripe level, convert it into file level */ ra_end = ra->cra_end;if (ra_end !=CL_PAGE_EOF ) - ra_end =lov_stripe_pgoff (loo->lo_lsm, index, ra_end, stripe); + ra->cra_end =lov_stripe_pgoff (loo->lo_lsm, index, + ra_end, stripe); + +/* boundary of current component */ + ra_end =cl_index (obj, (loff_t )lov_lse (loo, index)->lsme_extent.e_end); +if (ra_end !=CL_PAGE_EOF && ra->cra_end >= ra_end) + ra->cra_end = ra_end -1 ; + +if (r0->lo_nr ==1 )/* single stripe file */ +return 0 ; pps =lov_lse (loo, index)->lsme_stripe_size >>PAGE_SHIFT ;CDEBUG (D_READA ,DFID " max_index = %lu, pps = %u, index = %u, stripe_size = %u, stripe no = %u, start index = %lu\n" , -PFID (lu_object_fid (lov2lu (loo))), ra_end, pps, index, +PFID (lu_object_fid (lov2lu (loo))), ra->cra_end, pps, index,lov_lse (loo, index)->lsme_stripe_size, stripe, start);/* never exceed the end of the stripe */ - ra->cra_end =min_t (pgoff_t, ra_end, start + pps - start % pps -1 ); + ra->cra_end =min_t (pgoff_t, + ra->cra_end, start + pps - start % pps -1 );return 0 ; }
drivers/staging/lustre/lustre/lov/lov_page.c +3 -1
@@ -56,7 +56,9 @@ static int lov_comp_page_print(const struct lu_env *env, {struct lov_page *lp =cl2lov_page (slice); -return (*printer)(env, cookie,LUSTRE_LOV_NAME "-page@%p, raid0\n" , lp); +return (*printer)(env, cookie, +LUSTRE_LOV_NAME "-page@%p, comp index: %x\n" , + lp, lp->lps_index); }static const struct cl_page_operations lov_comp_page_ops = {
Signature · 1 line
1.8.3.1
PATCH 25/28 lustre: uapi: support negative flags
In reply to James SimmonsFrom: Niu Yawei <[email protected]>
'flags' can be negative flags.
WC-bug-id: https://jira.whamcloud.com/browse/LU-8998
Reviewed-on: https://review.whamcloud.com/26490
--- drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h +5 -2
@@ -413,9 +413,12 @@ enum lov_comp_md_entry_flags {LCME_FL_OFFLINE =0x00000004 ,/* Not used */ LCME_FL_PREFERRED =0x00000008 ,/* Not used */ LCME_FL_INIT =0x00000010 ,/* instantiated */ + LCME_FL_NEG = 0x80000000, /* used to indicate a negative + * flag, won't be stored on disk + */ }; -#define LCME_KNOWN_FLAGS LCME_FL_INIT +#define LCME_KNOWN_FLAGS (LCME_FL_NEG | LCME_FL_INIT)/* lcme_id can be specified as certain flags, and the the first * bit of lcme_id is used to indicate that the ID is representing
@@ -426,7 +429,7 @@ enum lcme_id {LCME_ID_INVAL =0x0 ,LCME_ID_MAX =0x7FFFFFFF ,LCME_ID_ALL =0xFFFFFFFF , - LCME_ID_NONE = 0x80000000 + LCME_ID_NOT_ID = LCME_FL_NEG };#define LCME_ID_MASK LCME_ID_MAX
Signature · 1 line
1.8.3.1
PATCH 26/28 lustre: llite: return v1/v3 layout for legacy app
In reply to James SimmonsFrom: Niu Yawei <[email protected]>
Legacy app such as ADIO fetches LOVEA by ioctl LL_IOC_LOV_GETSTRIPE and treats file layout as v1/v3 blindly, we'd return a reasonable v1/v3 in this case.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9490
Reviewed-on: https://review.whamcloud.com/27183
--- drivers/staging/lustre/lustre/lov/lov_object.c | 2 +- drivers/staging/lustre/lustre/lov/lov_pack.c | 72 +++++++++++++++++++++++--- 2 files changed, 67 insertions(+), 7 deletions(-)
drivers/staging/lustre/lustre/lov/lov_object.c +1 -1
@@ -1615,7 +1615,7 @@ static int lov_object_getstripe(const struct lu_env *env, struct cl_object *obj,if (!lsm)return -ENODATA ; - rc =lov_getstripe (cl2lov (obj), lsm, lum); + rc =lov_getstripe (env,cl2lov (obj), lsm, lum);lov_lsm_put (lsm);return rc; }
drivers/staging/lustre/lustre/lov/lov_pack.c +66 -6
94 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 27/28 lustre: llite: restore ll_file_getstripe in ll_lov_setstripe
In reply to James SimmonsFrom: Bobi Jam <[email protected]>
Commit fafe6b4d4a6fa63cedff3bd44e6578009578b3d7 has get rid of the call to ll_file_getstripe in ll_lov_setstripe.
Add a @size parameter for series of xxx_getstripe interfaces, indicating the max buffer size that user provides to hold the stripe information. It is mainly for the ll_lov_setstripe, which will call ll_file_getstripe to fetch basic stripe inforation.
Add LL_IOC_LOV_SETSTRIPE_NEW/LL_IOC_LOV_GETSTRIPE_NEW ioctl interface which defines the interface correctly, which could be used in later Lustre versions.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9367
Reviewed-on: https://review.whamcloud.com/26915
--- .../lustre/include/uapi/linux/lustre/lustre_user.h | 2 ++ drivers/staging/lustre/lustre/include/cl_object.h | 4 +-- drivers/staging/lustre/lustre/llite/dir.c | 5 ++- drivers/staging/lustre/lustre/llite/file.c | 36 +++++++++++++++------- .../staging/lustre/lustre/lov/lov_cl_internal.h | 5 +-- drivers/staging/lustre/lustre/lov/lov_object.c | 4 +-- drivers/staging/lustre/lustre/lov/lov_pack.c | 33 ++++++++++++++------ drivers/staging/lustre/lustre/obdclass/cl_object.c | 5 +-- 8 files changed, 64 insertions(+), 30 deletions(-)
drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h +2 -0
@@ -227,7 +227,9 @@ struct ost_id {#define LL_IOC_SETFLAGS _IOW('f', 152, long)#define LL_IOC_CLRFLAGS _IOW('f', 153, long)#define LL_IOC_LOV_SETSTRIPE _IOW('f', 154, long) +#define LL_IOC_LOV_SETSTRIPE_NEW _IOWR('f', 154, struct lov_user_md)#define LL_IOC_LOV_GETSTRIPE _IOW('f', 155, long) +#define LL_IOC_LOV_GETSTRIPE_NEW _IOR('f', 155, struct lov_user_md)#define LL_IOC_LOV_SETEA _IOW('f', 156, long)/* LL_IOC_RECREATE_OBJ 157 obsolete */ /* LL_IOC_RECREATE_FID 158 obsolete */
drivers/staging/lustre/lustre/include/cl_object.h +2 -2
@@ -390,7 +390,7 @@ struct cl_object_operations {* Object getstripe method. */ int (*coo_getstripe)(const struct lu_env *env,struct cl_object *obj, -struct lov_user_md __user *lum); +struct lov_user_md __user *lum,size_t size);/** * Get FIEMAP mapping from the object. */
@@ -2057,7 +2057,7 @@ int cl_conf_set(const struct lu_env *env, struct cl_object *obj,int cl_object_prune (const struct lu_env *env,struct cl_object *obj);void cl_object_kill (const struct lu_env *env,struct cl_object *obj);int cl_object_getstripe (const struct lu_env *env,struct cl_object *obj, -struct lov_user_md __user *lum); +struct lov_user_md __user *lum,size_t size);int cl_object_fiemap (const struct lu_env *env,struct cl_object *obj,struct ll_fiemap_info_key *fmkey,struct fiemap *fiemap,size_t *buflen);
drivers/staging/lustre/lustre/llite/dir.c +4 -1
@@ -1224,6 +1224,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)return rc; } +case LL_IOC_LOV_SETSTRIPE_NEW :case LL_IOC_LOV_SETSTRIPE : {struct lov_user_md_v3 lumv3;struct lov_user_md_v1 *lumv1 = (struct lov_user_md_v1 *)&lumv3;
@@ -1362,6 +1363,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)case IOC_OBD_STATFS :return ll_obd_statfs (inode, (void __user *)arg);case LL_IOC_LOV_GETSTRIPE : +case LL_IOC_LOV_GETSTRIPE_NEW :case LL_IOC_MDC_GETINFO :case IOC_MDC_GETFILEINFO :case IOC_MDC_GETFILESTRIPE : {
@@ -1404,7 +1406,8 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) }if (cmd ==IOC_MDC_GETFILESTRIPE || - cmd ==LL_IOC_LOV_GETSTRIPE ) { + cmd ==LL_IOC_LOV_GETSTRIPE || + cmd ==LL_IOC_LOV_GETSTRIPE_NEW ) { lump = (struct lov_user_md __user *)arg; }else {struct lov_user_mds_data __user *lmdp;
drivers/staging/lustre/lustre/llite/file.c +25 -11
@@ -1481,7 +1481,7 @@ int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename, }static int ll_lov_setea (struct inode *inode,struct file *file, -unsigned long arg) +void __user *arg) {__u64 flags =MDS_OPEN_HAS_OBJS |FMODE_WRITE ;struct lov_user_md *lump;
@@ -1496,7 +1496,7 @@ static int ll_lov_setea(struct inode *inode, struct file *file,if (!lump)return -ENOMEM ; -if (copy_from_user (lump, (struct lov_user_md __user *)arg, lum_size)) { +if (copy_from_user (lump, arg, lum_size)) {kvfree (lump);return -EFAULT ; }
@@ -1509,8 +1509,7 @@ static int ll_lov_setea(struct inode *inode, struct file *file,return rc; } -static int ll_file_getstripe (struct inode *inode, -struct lov_user_md __user *lum) +static int ll_file_getstripe (struct inode *inode,void __user *lum,size_t size) {struct lu_env *env;u16 refcheck;
@@ -1520,13 +1519,13 @@ static int ll_file_getstripe(struct inode *inode,if (IS_ERR (env))return PTR_ERR (env); - rc =cl_object_getstripe (env,ll_i2info (inode)->lli_clob, lum); + rc =cl_object_getstripe (env,ll_i2info (inode)->lli_clob, lum, size);cl_env_put (env, &refcheck);return rc; }static int ll_lov_setstripe (struct inode *inode,struct file *file, -unsigned long arg) +void __user *arg) {struct lov_user_md __user *lum = (struct lov_user_md __user *)arg;struct lov_user_md *klum;
@@ -1540,8 +1539,22 @@ static int ll_lov_setstripe(struct inode *inode, struct file *file, lum_size = rc; rc =ll_lov_setstripe_ea_info (inode, file->f_path.dentry, flags, klum, lum_size); -cl_lov_delay_create_clear (&file->f_flags); +if (!rc) { +u32 gen; + + rc =put_user (0 , &lum->lmm_stripe_count); +if (rc) + goto out; + rc =ll_layout_refresh (inode, &gen); +if (rc) + goto out; + + rc =ll_file_getstripe (inode, arg, lum_size); + } + +cl_lov_delay_create_clear (&file->f_flags); +out:kfree (klum);return rc; }
@@ -2293,9 +2306,10 @@ int ll_ioctl_fssetxattr(struct inode *inode, unsigned int cmd, }return 0 ;case LL_IOC_LOV_SETSTRIPE : -return ll_lov_setstripe (inode, file, arg); +case LL_IOC_LOV_SETSTRIPE_NEW : +return ll_lov_setstripe (inode, file, (void __user *) arg);case LL_IOC_LOV_SETEA : -return ll_lov_setea (inode, file, arg); +return ll_lov_setea (inode, file, (void __user *) arg);case LL_IOC_LOV_SWAP_LAYOUTS : {struct file *file2;struct lustre_swap_layouts lsl;
@@ -2348,8 +2362,8 @@ int ll_ioctl_fssetxattr(struct inode *inode, unsigned int cmd,return rc; }case LL_IOC_LOV_GETSTRIPE : -return ll_file_getstripe (inode, - (struct lov_user_md __user *)arg); +case LL_IOC_LOV_GETSTRIPE_NEW : +return ll_file_getstripe (inode, (void __user *)arg,0 );case FSFILT_IOC_GETFLAGS :case FSFILT_IOC_SETFLAGS :return ll_iocontrol (inode, file, cmd, arg);
drivers/staging/lustre/lustre/lov/lov_cl_internal.h +3 -2
@@ -651,8 +651,9 @@ static inline struct lov_stripe_md_entry *lov_lse(struct lov_object *lov, int i) }/* lov_pack.c */ -int lov_getstripe (struct lov_object *obj,struct lov_stripe_md *lsm, -struct lov_user_md __user *lump); +int lov_getstripe (const struct lu_env *env,struct lov_object *obj, +struct lov_stripe_md *lsm,struct lov_user_md __user *lump, +size_t size);/** @} lov */
drivers/staging/lustre/lustre/lov/lov_object.c +2 -2
@@ -1605,7 +1605,7 @@ static int lov_object_fiemap(const struct lu_env *env, struct cl_object *obj, }static int lov_object_getstripe (const struct lu_env *env,struct cl_object *obj, -struct lov_user_md __user *lum) +struct lov_user_md __user *lum,size_t size) {struct lov_object *lov =cl2lov (obj);struct lov_stripe_md *lsm;
@@ -1615,7 +1615,7 @@ static int lov_object_getstripe(const struct lu_env *env, struct cl_object *obj,if (!lsm)return -ENODATA ; - rc =lov_getstripe (env,cl2lov (obj), lsm, lum); + rc =lov_getstripe (env,cl2lov (obj), lsm, lum, size);lov_lsm_put (lsm);return rc; }
drivers/staging/lustre/lustre/lov/lov_pack.c +23 -10
@@ -314,12 +314,16 @@ struct lov_stripe_md *lov_unpackmd(struct lov_obd *lov, void *buf,* @lump is a pointer to an in-core struct with lmm_ost_count indicating * the maximum number of OST indices which will fit in the user buffer. * lmm_magic must be LOV_USER_MAGIC. +* +* If @size > 0, User specified limited buffer size, usually the buffer is from +* ll_lov_setstripe(), and the buffer can only hold basic layout template info. */ int lov_getstripe (const struct lu_env *env,struct lov_object *obj, -struct lov_stripe_md *lsm,struct lov_user_md __user *lump) +struct lov_stripe_md *lsm,struct lov_user_md __user *lump, +size_t size) {/* we use lov_user_md_v3 because it is larger than lov_user_md_v1 */ -struct lov_mds_md *lmmk; +struct lov_mds_md *lmmk, *lmm;struct lov_user_md_v1 lum;ssize_t lmm_size, lum_size =0 ;static bool printed;
@@ -410,15 +414,24 @@ int lov_getstripe(const struct lu_env *env, struct lov_object *obj, comp_md = (struct lov_mds_md *)((char *)comp_v1 + comp_v1->lcm_entries[i].lcme_offset); } -if (copy_to_user (lump, comp_md, lum_size)) { - rc = -EFAULT ; - goto out_free; - } + + lmm = comp_md; + lmm_size = lum_size; }else { -if (copy_to_user (lump, lmmk, lmmk_size)) { - rc = -EFAULT ; - goto out_free; - } + lmm = lmmk; + lmm_size = lmmk_size; + } +/** +* User specified limited buffer size, usually the buffer is +* from ll_lov_setstripe(), and the buffer can only hold basic +* layout template info. +*/ +if (size ==0 || size > lmm_size) + size = lmm_size; + +if (copy_to_user (lump, lmm, size)) { + rc = -EFAULT ; + goto out_free; } out_free:
drivers/staging/lustre/lustre/obdclass/cl_object.c +3 -2
@@ -323,7 +323,7 @@ int cl_object_prune(const struct lu_env *env, struct cl_object *obj)* Get stripe information of this object. */ int cl_object_getstripe (const struct lu_env *env,struct cl_object *obj, -struct lov_user_md __user *uarg) +struct lov_user_md __user *uarg,size_t size) {struct lu_object_header *top;int result =0 ;
@@ -331,7 +331,8 @@ int cl_object_getstripe(const struct lu_env *env, struct cl_object *obj, top = obj->co_lu.lo_header;list_for_each_entry (obj, &top->loh_layers, co_lu.lo_linkage) {if (obj->co_ops->coo_getstripe) { - result = obj->co_ops->coo_getstripe (env, obj, uarg); + result = obj->co_ops->coo_getstripe (env, obj, uarg, + size);if (result)break ; }
Signature · 1 line
1.8.3.1
PATCH 28/28 lustre: lov: do not split IO for single striped file
In reply to James SimmonsFrom: Jinshan Xiong <[email protected]>
stripe size for single striped file is not reliable, it shouldn't be used to split I/O.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9841
Reviewed-on: https://review.whamcloud.com/28451
--- drivers/staging/lustre/lustre/lov/lov_io.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/staging/lustre/lustre/lov/lov_io.c +9 -6
@@ -466,7 +466,6 @@ static int lov_io_rw_iter_init(const struct lu_env *env,struct cl_io *io = ios->cis_io;u64 start = io->u.ci_rw.crw_pos;struct lov_stripe_md_entry *lse; -unsigned long ssize;int index;u64 next;
@@ -491,11 +490,15 @@ static int lov_io_rw_iter_init(const struct lu_env *env, lse =lov_lse (lio->lis_object, index); - ssize = lse->lsme_stripe_size; -lov_do_div64 (start, ssize); - next = (start +1 ) * ssize; -if (next <= start * ssize) - next = ~0ull ; + next =MAX_LFS_FILESIZE ; +if (lse->lsme_stripe_count >1 ) { +unsigned long ssize = lse->lsme_stripe_size; + +lov_do_div64 (start, ssize); + next = (start +1 ) * ssize; +if (next <= start * ssize) + next =MAX_LFS_FILESIZE ; + } LASSERTF(io->u.ci_rw.crw_pos >= lse->lsme_extent.e_start, "pos %lld, [%lld, %lld]\n", io->u.ci_rw.crw_pos,
Signature · 1 line
1.8.3.1
cover lustre: PFL port to linux client
In reply to James SimmonsQuoted 6 lines · James Simmons
This is the initial PFL port to the linux lustre client. This opens up feed back on the port so far. Currently sanity passes but the test for sanity-pfl fail as below. I have been tracking downing various bugs but this one remains and I haven't found out why its failing. So far from what I can tell is
lov_io_setattr_iter_init()it returning-ENODATAdue tolsm_entry_inited()is not initialized.
Having that invariant in cl_io_iter_fini() seems strange. It is guaranteed to fir eif cl_io_iter_init() fails - if that is not permitted, I would expect an invariant a lot closer to the failure.
What happens if you just remove the LINVRNT() ??
NeilBrown
Quoted 85 lines
Hoping that sending this out more eyes might help to see where this last problem is.
Lustre: DEBUG MARKER: == sanity-pfl test 0: Create full components file, no reused OSTs ======= ============================= 10:53:08 (1545061988)
Lustre: DEBUG MARKER: create directory /lustre/lustre/d0.sanity-pfl
Lustre: DEBUG MARKER: createcomp_file
Lustre: DEBUG MARKER: instantiate components
LustreError: 19350:0:(cl_io.c:439:cl_io_iter_fini())ASSERTION( io->ci_state == CIS_UNLOCKED )failed:
LustreError: 19350:0:(cl_io.c:439:cl_io_iter_fini()) LBUG
Pid: 19350, comm: dd 4.20.0-rc6+ #1 SMP PREEMPT Sat Dec 15 11:22:06 EST 2018Call Trace: libcfs_call_trace+0x8b/0xc0 [libcfs] lbug_with_loc+0x41/0x90 [libcfs] cl_io_iter_fini+0x10c/0x110 [obdclass] cl_io_loop+0x46/0x220 [obdclass] cl_setattr_ost+0x1ed/0x2a0 [lustre] ll_setattr_raw+0x797/0x980 [lustre] notify_change+0x1dc/0x430 do_truncate+0x72/0xc0 do_sys_ftruncate+0xf5/0x160 do_syscall_64+0x68/0x38fBobi Jam (20):
lustre: lov: move code for PFL work
lustre: lov: mergelov_mds_md_v3andlov_mds_md_v1handling
lustre: lov: foldlmm_verify()handling intolmm_unpackmd()
lustre: lov: create structlov_stripe_md_entry
lustre: lov: add composite layout unpacking
lustre: lov: embedded raid0 in structlov_layout_composite
lustre: lov: migrate lov raid0 to future PFL component handling
lustre: lov: reduce code indentation
lustre: lov: changelo_entriesto array.
lustre: lov: move around PFL code and cleanups
lustre: lov: remove lsm_stripe_by_[index|offset]_plain
lustre: lov: add loopinglsm_entry_counttimes
lustre: lov: create lov_comp_* wrappers
lustre: clio: client side implementation for PFL
lustre: pfl: dynamic layout modification with write/truncate
lustre: pfl: calculate PFL file LOVEA correctly
lustre: lov: keep minimum LOVEA size
lustre: pfl: fix hang with grouplocks
lustre: pfl: fix ost poolop->sizehandling
lustre: llite: restorell_file_getstripeinll_lov_setstripeFan Yong (1):
lustre: pfl: enhance PFID EA for PFLJinshan Xiong (3):
lustre: pfl: Read should not trigger layout write intent
lustre: lov: readahead shouldn't exceed component boundary
lustre: lov: do not split IO for single striped fileNiu Yawei (4):
lustre: pfl: Basic data structures for composite layout
lustre: clio: getstripe support comp layout
lustre: uapi: support negative flags
lustre: llite: return v1/v3 layout for legacy app.../lustre/include/uapi/linux/lustre/lustre_idl.h | 36 +- .../lustre/include/uapi/linux/lustre/lustre_user.h | 88 ++- drivers/staging/lustre/lustre/include/cl_object.h | 12 +- drivers/staging/lustre/lustre/include/lustre_sec.h | 4 +- .../staging/lustre/lustre/include/lustre_swab.h | 1 + drivers/staging/lustre/lustre/include/obd.h | 4 - drivers/staging/lustre/lustre/llite/dir.c | 38 +- drivers/staging/lustre/lustre/llite/file.c | 185 +++-- .../staging/lustre/lustre/llite/llite_internal.h | 3 + drivers/staging/lustre/lustre/llite/vvp_io.c | 44 +- drivers/staging/lustre/lustre/llite/xattr.c | 70 +- .../staging/lustre/lustre/lov/lov_cl_internal.h | 191 ++--- drivers/staging/lustre/lustre/lov/lov_ea.c | 570 ++++++++++---- drivers/staging/lustre/lustre/lov/lov_internal.h | 175 +++-- drivers/staging/lustre/lustre/lov/lov_io.c | 651 +++++++++------- drivers/staging/lustre/lustre/lov/lov_lock.c | 94 ++- drivers/staging/lustre/lustre/lov/lov_merge.c | 12 +- drivers/staging/lustre/lustre/lov/lov_object.c | 833 ++++++++++++--------- drivers/staging/lustre/lustre/lov/lov_offset.c | 65 +- drivers/staging/lustre/lustre/lov/lov_pack.c | 364 +++++---- drivers/staging/lustre/lustre/lov/lov_page.c | 42 +- drivers/staging/lustre/lustre/lov/lov_pool.c | 20 +- drivers/staging/lustre/lustre/lov/lovsub_object.c | 23 +- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 79 +- drivers/staging/lustre/lustre/obdclass/cl_object.c | 5 +-
Quoted 11 lines
drivers/staging/lustre/lustre/obdclass/genops.c | 16 +- drivers/staging/lustre/lustre/osc/osc_io.c | 4 +- drivers/staging/lustre/lustre/ptlrpc/layout.c | 6 +- .../staging/lustre/lustre/ptlrpc/pack_generic.c | 84 ++- .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 7 +- drivers/staging/lustre/lustre/ptlrpc/sec.c | 5 +- drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 125 +++- 32 files changed, 2483 insertions(+), 1373 deletions(-)Signature · 1 line
1.8.3.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20181218/04e0a916/attachment.sig>
cover lustre: PFL port to linux client
Quoted 9 lines · NeilBrown
Quoted 6 lines · James Simmons
This is the initial PFL port to the linux lustre client. This opens up feed back on the port so far. Currently sanity passes but the test for sanity-pfl fail as below. I have been tracking downing various bugs but this one remains and I haven't found out why its failing. So far from what I can tell is
lov_io_setattr_iter_init()it returning-ENODATAdue tolsm_entry_inited()is not initialized.
Quoted 5 lines
Having that invariant in
cl_io_iter_fini()seems strange. It is guaranteed to fir eifcl_io_iter_init()fails - if that is not permitted, I would expect an invariant a lot closer to the failure.What happens if you just remove the
LINVRNT()??
I dug through the code some more, and I'm sure that LINVRNT() is wrong.
The cl_io_iter() call is meant to fail early, before ci_state gets to CIS_LOCKED, let alone CIS_UNLOCKED. It sets ->ci_need_write_intent when it records the failure. The code is then meant to fall through to the cl_io_fini() call in cl_setattr_ost(), which calls into vvp_io_fini)_ which notices ->ci_need_write_intent, and calls ll_layout_write_intent(), which presumably initializes the things that weren't initialized before. This also sets ->ci_need_restart = 1 so that cl_setattr_ost() loops around to "again:" and calls cl_io_init() again.
So the invariant in cl_io_iter_fini() should probably be
LINVRNT(io->ci_state == CIS_INIT || io->ci_state == CIS_UNLOCKED);
or something like that. Maybe needs CIS_IT_ENDED as well.
LINVRNT(io->ci_state <= CIS_INIT || io->ci_state >= CIS_UNLOCKED);
??
Thanks,
NeilBrown
Quoted 97 lines
NeilBrown
Quoted 94 lines
Hoping that sending this out more eyes might help to see where this last problem is.
Lustre: DEBUG MARKER: == sanity-pfl test 0: Create full components file, no reused OSTs ======= ============================= 10:53:08 (1545061988)
Lustre: DEBUG MARKER: create directory /lustre/lustre/d0.sanity-pfl
Lustre: DEBUG MARKER: createcomp_file
Lustre: DEBUG MARKER: instantiate components
LustreError: 19350:0:(cl_io.c:439:cl_io_iter_fini())ASSERTION( io->ci_state == CIS_UNLOCKED )failed:
LustreError: 19350:0:(cl_io.c:439:cl_io_iter_fini()) LBUG
Pid: 19350, comm: dd 4.20.0-rc6+ #1 SMP PREEMPT Sat Dec 15 11:22:06 EST 2018Call Trace: libcfs_call_trace+0x8b/0xc0 [libcfs] lbug_with_loc+0x41/0x90 [libcfs] cl_io_iter_fini+0x10c/0x110 [obdclass] cl_io_loop+0x46/0x220 [obdclass] cl_setattr_ost+0x1ed/0x2a0 [lustre] ll_setattr_raw+0x797/0x980 [lustre] notify_change+0x1dc/0x430 do_truncate+0x72/0xc0 do_sys_ftruncate+0xf5/0x160 do_syscall_64+0x68/0x38fBobi Jam (20):
lustre: lov: move code for PFL work
lustre: lov: mergelov_mds_md_v3andlov_mds_md_v1handling
lustre: lov: foldlmm_verify()handling intolmm_unpackmd()
lustre: lov: create structlov_stripe_md_entry
lustre: lov: add composite layout unpacking
lustre: lov: embedded raid0 in structlov_layout_composite
lustre: lov: migrate lov raid0 to future PFL component handling
lustre: lov: reduce code indentation
lustre: lov: changelo_entriesto array.
lustre: lov: move around PFL code and cleanups
lustre: lov: remove lsm_stripe_by_[index|offset]_plain
lustre: lov: add loopinglsm_entry_counttimes
lustre: lov: create lov_comp_* wrappers
lustre: clio: client side implementation for PFL
lustre: pfl: dynamic layout modification with write/truncate
lustre: pfl: calculate PFL file LOVEA correctly
lustre: lov: keep minimum LOVEA size
lustre: pfl: fix hang with grouplocks
lustre: pfl: fix ost poolop->sizehandling
lustre: llite: restorell_file_getstripeinll_lov_setstripeFan Yong (1):
lustre: pfl: enhance PFID EA for PFLJinshan Xiong (3):
lustre: pfl: Read should not trigger layout write intent
lustre: lov: readahead shouldn't exceed component boundary
lustre: lov: do not split IO for single striped fileNiu Yawei (4):
lustre: pfl: Basic data structures for composite layout
lustre: clio: getstripe support comp layout
lustre: uapi: support negative flags
lustre: llite: return v1/v3 layout for legacy app.../lustre/include/uapi/linux/lustre/lustre_idl.h | 36 +- .../lustre/include/uapi/linux/lustre/lustre_user.h | 88 ++- drivers/staging/lustre/lustre/include/cl_object.h | 12 +- drivers/staging/lustre/lustre/include/lustre_sec.h | 4 +- .../staging/lustre/lustre/include/lustre_swab.h | 1 + drivers/staging/lustre/lustre/include/obd.h | 4 - drivers/staging/lustre/lustre/llite/dir.c | 38 +- drivers/staging/lustre/lustre/llite/file.c | 185 +++-- .../staging/lustre/lustre/llite/llite_internal.h | 3 + drivers/staging/lustre/lustre/llite/vvp_io.c | 44 +- drivers/staging/lustre/lustre/llite/xattr.c | 70 +- .../staging/lustre/lustre/lov/lov_cl_internal.h | 191 ++--- drivers/staging/lustre/lustre/lov/lov_ea.c | 570 ++++++++++---- drivers/staging/lustre/lustre/lov/lov_internal.h | 175 +++-- drivers/staging/lustre/lustre/lov/lov_io.c | 651 +++++++++------- drivers/staging/lustre/lustre/lov/lov_lock.c | 94 ++- drivers/staging/lustre/lustre/lov/lov_merge.c | 12 +- drivers/staging/lustre/lustre/lov/lov_object.c | 833 ++++++++++++--------- drivers/staging/lustre/lustre/lov/lov_offset.c | 65 +- drivers/staging/lustre/lustre/lov/lov_pack.c | 364 +++++---- drivers/staging/lustre/lustre/lov/lov_page.c | 42 +- drivers/staging/lustre/lustre/lov/lov_pool.c | 20 +- drivers/staging/lustre/lustre/lov/lovsub_object.c | 23 +- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 79 +- drivers/staging/lustre/lustre/obdclass/cl_object.c | 5 +- drivers/staging/lustre/lustre/obdclass/genops.c | 16 +- drivers/staging/lustre/lustre/osc/osc_io.c | 4 +- drivers/staging/lustre/lustre/ptlrpc/layout.c | 6 +- .../staging/lustre/lustre/ptlrpc/pack_generic.c | 84 ++- .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 7 +- drivers/staging/lustre/lustre/ptlrpc/sec.c | 5 +- drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 125 +++- 32 files changed, 2483 insertions(+), 1373 deletions(-)
Quoted 6 lines
Quoted 2 lines
Signature · 1 line
1.8.3.1_______________________________________________
lustre-devel mailing list
lustre-devel at lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20181220/04645519/attachment.sig>
cover lustre: PFL port to linux client
Quoted 31 lines · NeilBrown
Quoted 10 lines · James Simmons
Quoted 7 lines
This is the initial PFL port to the linux lustre client. This opens up feed back on the port so far. Currently sanity passes but the test for sanity-pfl fail as below. I have been tracking downing various bugs but this one remains and I haven't found out why its failing. So far from what I can tell is
lov_io_setattr_iter_init()it returning-ENODATAdue tolsm_entry_inited()is not initialized.Quoted 5 lines
Having that invariant in
cl_io_iter_fini()seems strange. It is guaranteed to fir eifcl_io_iter_init()fails - if that is not permitted, I would expect an invariant a lot closer to the failure.What happens if you just remove the
LINVRNT()??I dug through the code some more, and I'm sure that
LINVRNT()is wrong.The
cl_io_iter()call is meant to fail early, beforeci_stategets toCIS_LOCKED, let aloneCIS_UNLOCKED. It sets ->ci_need_write_intent when it records the failure. The code is then meant to fall through to thecl_io_fini()call incl_setattr_ost(), which calls into vvp_io_fini)_ which notices ->ci_need_write_intent, and callsll_layout_write_intent(), which presumably initializes the things that weren't initialized before. This also sets ->ci_need_restart = 1 so thatcl_setattr_ost()loops around to "again:" and callscl_io_init()again.So the invariant in
cl_io_iter_fini()should probably be
Quoted 7 lines
LINVRNT(io->ci_state == CIS_INIT || io->ci_state == CIS_UNLOCKED);or something like that. Maybe needs
CIS_IT_ENDEDas well.LINVRNT(io->ci_state <= CIS_INIT || io->ci_state >= CIS_UNLOCKED);??
You are right. I spent two weeks thinking I did the port wrong :-( I used the second version which worked and saw only sanity-pfl test 11 failing. I opened a ticket on this issue :
https://jira.whamcloud.com/browse/LU-11828
and have pushed a patch for Bobi Jam to look at. We should have something worked out soon. So PFL mostly worked outside of that. I will combine this fix with a bunch others. I tracked down the majority of the causes of the failures seen in the sanity testing.